From 296ab55ef7d74f3762a5a8e8f3454014ab5d2a42 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 26 Sep 2015 12:02:09 +0200 Subject: [PATCH 01/27] Switching the key bindings for single face select (ctrl+shift+LMB) with multi face select (ctrl+shift+alt+LMB) --- radiant/drag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radiant/drag.cpp b/radiant/drag.cpp index a6c2bf0d..3840d578 100644 --- a/radiant/drag.cpp +++ b/radiant/drag.cpp @@ -367,7 +367,7 @@ void Drag_Begin( int x, int y, int buttons, // ctrl-shift LBUTTON = select single face if ( sf_camera && buttons == ( MK_LBUTTON | MK_CONTROL | MK_SHIFT ) && g_qeglobals.d_select_mode != sel_curvepoint ) { - if ( Sys_AltDown() ) { + if ( !Sys_AltDown() ) { brush_t *b; for ( b = selected_brushes.next ; b != &selected_brushes ; b = b->next ) { From ac95505d939cf220ae923e0472b10ee72aff3699 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 26 Sep 2015 22:47:39 +0200 Subject: [PATCH 02/27] Increase the max open files to its maximum for msvc --- radiant/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/radiant/main.cpp b/radiant/main.cpp index f60cd6bd..bd095550 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -418,6 +418,10 @@ int main( int argc, char* argv[] ) { const char *libgl; int i, j, k; +#if defined( _WIN32 ) && defined( _MSC_VER ) + //increase the max open files to its maximum for the C run-time of MSVC + _setmaxstdio( 2048 ); +#endif /* Rambetter on Sat Nov 13, 2010: From 3496e421c67327c62740fe56102b94c4799bf608 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Mon, 28 Sep 2015 15:22:37 +0200 Subject: [PATCH 03/27] Min speed for 3d mouse velocity --- radiant/preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index e3b0f66d..789b490e 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -1837,7 +1837,7 @@ void PrefsDlg::BuildDialog(){ gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); // adjustment - adj = gtk_adjustment_new( 100, 50, 300, 1, 10, 10 ); + adj = gtk_adjustment_new( 100, 1, 300, 1, 10, 10 ); AddDialogData( adj, &m_nMoveSpeed, DLG_ADJ_INT ); // scale From 930bd66b87981993ecf87b820e21d43acde09896 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Mon, 28 Sep 2015 23:39:57 +0200 Subject: [PATCH 04/27] Fix for a crash --- radiant/main.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/radiant/main.cpp b/radiant/main.cpp index 62f889bc..40fe7fcc 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -981,14 +981,14 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){ // initialise the first step out = new char[BIG_PATH_MAX]; + *out = 0; g_ptr_array_add( out_array, out ); in = ValueForKey( g_qeglobals.d_project_entity, bspaction ); while ( *in ) { if ( in[0] == '!' ) { - Q_strncpyz( out, rsh, sizeof( out ) ); - out += strlen( rsh ); + strncat( out, rsh, BIG_PATH_MAX ); in++; continue; } @@ -998,36 +998,39 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){ if ( g_PrefsDlg.m_bWatchBSP ) { // -connect global option (the only global option so far anyway) strcpy( tmp, " -connect 127.0.0.1:39000 " ); - Q_strncpyz( out, tmp, sizeof( out ) ); - out += strlen( tmp ); + strncat( out, tmp, BIG_PATH_MAX ); } in++; continue; } if ( in[0] == '$' ) { // $ expansion - Q_strncpyz( out, src, sizeof( out ) ); - out += strlen( src ); + strncat( out, src, BIG_PATH_MAX ); in++; continue; } if ( in[0] == '@' ) { - *out++ = '"'; + strncat( out, "\"", BIG_PATH_MAX ); in++; continue; } if ( in[0] == '&' ) { if ( in[1] == '&' ) { // start a new step - *out = 0; in = in + 2; out = new char[BIG_PATH_MAX]; + *out = 0; g_ptr_array_add( out_array, out ); } } - *out++ = *in++; + size_t len = strlen( out ); + if( ( len + 1 ) < BIG_PATH_MAX ) + { + out[len++] = *in; + out[len] = '\0'; + } + in++; } - *out = 0; } void FindReplace( CString& strContents, const char* pTag, const char* pValue ){ @@ -1149,7 +1152,7 @@ void RunBsp( char *command ){ if ( g_PrefsDlg.m_bWatchBSP ) { // grab the file name for engine running char *bspname = new char[1024]; - ExtractFileName( currentmap, bspname, sizeof( bspname ) ); + ExtractFileName( currentmap, bspname, 1024 ); StripExtension( bspname ); g_pParentWnd->GetWatchBSP()->DoMonitoringLoop( sys, bspname ); } else { From 6ab9b6b8c80eb6ebcb55b1cc3b67e2744d98fcfc Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 29 Sep 2015 00:56:18 +0200 Subject: [PATCH 05/27] Small Patch Inspector fix --- radiant/gtkdlgs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 1cfeea94..dd13e824 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -2912,11 +2912,11 @@ int DoTextureLayout( float *fx, float *fy ){ gtk_widget_show( label ); x = gtk_entry_new(); - gtk_grid_attach( GTK_GRID( table ), label, 1, 0, 1, 1 ); + gtk_grid_attach( GTK_GRID( table ), x, 1, 0, 1, 1 ); gtk_widget_show( x ); y = gtk_entry_new(); - gtk_grid_attach( GTK_GRID( table ), label, 1, 1, 1, 1 ); + gtk_grid_attach( GTK_GRID( table ), y, 1, 1, 1, 1 ); gtk_widget_show( y ); From f99c5019a3e865b04c4a18de3dcc98540bd344f3 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 29 Sep 2015 01:12:34 +0200 Subject: [PATCH 06/27] Allow key presses for insensitive patch inspector window --- radiant/patchdialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 0225f73f..3d0e43dd 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -711,10 +711,11 @@ void PatchDialog::GetPatchInfo(){ m_bListenChanged = true; - gtk_widget_set_sensitive( GTK_WIDGET( m_pWidget ), TRUE ); + //should use gtk_dialog_get_content_area instead of gtk_bin_get_child but m_pWidget is not a gtkdialog yet + gtk_widget_set_sensitive( GTK_WIDGET( gtk_bin_get_child( GTK_BIN( m_pWidget ) ) ), TRUE ); } else{ - gtk_widget_set_sensitive( GTK_WIDGET( m_pWidget ), FALSE ); + gtk_widget_set_sensitive( GTK_WIDGET( gtk_bin_get_child( GTK_BIN( m_pWidget ) ) ), FALSE ); Sys_FPrintf( SYS_WRN, "WARNING: No patch selected.\n" ); } From de0e3e2b8c5928e19f62beaf72ad7ba58952fcb7 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 29 Sep 2015 13:16:56 +0200 Subject: [PATCH 07/27] Preference option for the Texture Directory List --- radiant/mainframe.cpp | 26 +++++++++++++++++--------- radiant/preferences.cpp | 31 +++++++++++++++++++++++++++++++ radiant/preferences.h | 4 +++- 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 815a90ba..94dd724c 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2716,18 +2716,24 @@ void MainFrame::Create(){ m_pTexWnd = new TexWnd(); { GtkWidget* frame = create_framed_texwnd( m_pTexWnd ); - gint pos = 0; - GtkWidget* texDirList = create_texdirlist_widget( &pos ); + if( g_PrefsDlg.m_bShowTexDirList ) + { + gint pos = 0; + GtkWidget* texDirList = create_texdirlist_widget( &pos ); - GtkWidget* texSplit = gtk_paned_new( GTK_ORIENTATION_HORIZONTAL ); + GtkWidget* texSplit = gtk_paned_new( GTK_ORIENTATION_HORIZONTAL ); - gtk_paned_pack2( GTK_PANED( vsplit2 ), texSplit, TRUE, FALSE ); - gtk_paned_add1( GTK_PANED( texSplit ), texDirList ); - gtk_paned_add2( GTK_PANED( texSplit ), frame ); + gtk_paned_pack2( GTK_PANED( vsplit2 ), texSplit, TRUE, FALSE ); + gtk_paned_add1( GTK_PANED( texSplit ), texDirList ); + gtk_paned_add2( GTK_PANED( texSplit ), frame ); - gtk_paned_set_position( GTK_PANED( texSplit ), pos ); + gtk_paned_set_position( GTK_PANED( texSplit ), pos ); - gtk_widget_show( texSplit ); + gtk_widget_show( texSplit ); + } else + { + gtk_paned_pack2( GTK_PANED( vsplit2 ), frame, TRUE, TRUE ); + } } // console @@ -4680,6 +4686,7 @@ void MainFrame::OnPrefs() { bool bPluginToolbar = g_PrefsDlg.m_bPluginToolbar; bool bDetachableMenus = g_PrefsDlg.m_bDetachableMenus; bool bFloatingZ = g_PrefsDlg.m_bFloatingZ; + bool bShowTexDirList = g_PrefsDlg.m_bShowTexDirList; g_PrefsDlg.LoadPrefs(); @@ -4691,7 +4698,8 @@ void MainFrame::OnPrefs() { (g_PrefsDlg.m_bLatchedPluginToolbar != bPluginToolbar ) || (g_PrefsDlg.m_nLatchedShader != nShader ) || (g_PrefsDlg.m_nLatchedTextureQuality != nTextureQuality ) || - (g_PrefsDlg.m_bLatchedFloatingZ != bFloatingZ)) { + (g_PrefsDlg.m_bLatchedFloatingZ != bFloatingZ ) || + (g_PrefsDlg.m_bShowTexDirList != bShowTexDirList)) { gtk_MessageBoxNew(m_pWidget, "You must restart Radiant for the " "changes to take effect.", "Restart Radiant", MB_OK | MB_ICONINFORMATION); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 916a4682..52ab68c7 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -119,6 +119,7 @@ #define SHADERTEST_KEY "ShaderTest" #define GLLIGHTING_KEY "UseGLLighting" #define LOADSHADERS_KEY "LoadShaders" +#define SHOWTEXDIRLIST_KEY "ShowTextureDirectoryList" #define NOSTIPPLE_KEY "NoStipple" #define UNDOLEVELS_KEY "UndoLevels" #define VERTEXMODE_KEY "VertexSplit" @@ -1695,6 +1696,11 @@ void PrefsDlg::BuildDialog(){ gtk_tree_store_append( store, &tab, &group ); gtk_tree_store_set( store, &tab, 0, _( "Texture Settings" ), 1, (gpointer)PTAB_TEXTURE, -1 ); } + { + GtkTreeIter tab; + gtk_tree_store_append( store, &tab, &group ); + gtk_tree_store_set( store, &tab, 0, _( "Texture Directory List" ), 1, (gpointer)PTAB_TEXTURE_DIR, -1 ); + } } { @@ -2126,6 +2132,28 @@ void PrefsDlg::BuildDialog(){ // Add the page to the notebook gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); + + /******** Texture dir list group *********/ + preflabel = gtk_label_new( _( "Texture directory list" ) ); + gtk_widget_show( preflabel ); + pageframe = gtk_frame_new( _( "Texture directory list" ) ); + gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); + gtk_widget_show( pageframe ); + vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 5 ); + gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); + + check = gtk_check_button_new_with_label( _( "Show Texture Directory List" ) ); + gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); + AddDialogData( check, &m_bShowTexDirList, DLG_CHECK_BOOL ); + + + // Add the page to the notebook + gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); + + /******** Layout group *********/ preflabel = gtk_label_new( _( "Layout" ) ); gtk_widget_show( preflabel ); @@ -2988,6 +3016,9 @@ void PrefsDlg::LoadPrefs(){ mLocalPrefs.GetPref( LOADSHADERS_KEY, &m_nLatchedShader, 0 ); m_nShader = m_nLatchedShader; + + mLocalPrefs.GetPref( SHOWTEXDIRLIST_KEY, &m_bShowTexDirList, TRUE ); + mLocalPrefs.GetPref( NOCLAMP_KEY, &m_bNoClamp, FALSE ); mLocalPrefs.GetPref( SNAP_KEY, &m_bSnap, TRUE ); mLocalPrefs.GetPref( USERINI_KEY, &m_strUserPath, "" ); diff --git a/radiant/preferences.h b/radiant/preferences.h index 975c59ad..ff560da9 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -509,7 +509,7 @@ enum {SHADER_NONE = 0, SHADER_COMMON, SHADER_ALL}; // Gef: updated preferences dialog /*! Preference notebook page numbers */ -enum {PTAB_FRONT = 0, PTAB_GAME_SETTINGS, PTAB_2D, PTAB_CAMERA, PTAB_TEXTURE, PTAB_LAYOUT, PTAB_MOUSE, +enum {PTAB_FRONT = 0, PTAB_GAME_SETTINGS, PTAB_2D, PTAB_CAMERA, PTAB_TEXTURE, PTAB_TEXTURE_DIR, PTAB_LAYOUT, PTAB_MOUSE, PTAB_EDITING, PTAB_STARTUP, PTAB_PATHS, PTAB_BRUSH, PTAB_MISC, PTAB_BSPMONITOR} pref_tabs; GtkWidget *notebook; @@ -723,6 +723,8 @@ int m_nLatchedTextureQuality; // texture compression format int m_nTextureCompressionFormat; +bool m_bShowTexDirList; + int m_nLightRadiuses; bool m_bQ3Map2Texturing; From 45a24f3134b30d189247ce08181062a7545d90f9 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 29 Sep 2015 18:03:12 +0200 Subject: [PATCH 08/27] Fixed Texture Size for the Texture Browser --- radiant/preferences.cpp | 53 +++++++++++++++++++++++++++++++++++++++++ radiant/preferences.h | 3 +++ radiant/texwindow.cpp | 11 ++++++--- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 52ab68c7..5208a077 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -105,6 +105,9 @@ #define CHASEMOUSE_KEY "ChaseMouse" #define MOUSEWHEELZOOM_KEY "MousewheelZoom" #define ENTITYSHOW_KEY "EntityShow" +#define FIXEDTEXSIZE_KEY "UseFixedTextureSize" +#define FIXEDTEXSIZEWIDTH_KEY "FixedTextureSizeWidth" +#define FIXEDTEXSIZEHEIGHT_KEY "FixedTextureSizeHeight" #define TEXTURESCALE_KEY "TextureScale" #define TEXTURESCROLLBAR_KEY "TextureScrollbar" #define DISPLAYLISTS_KEY "UseDisplayLists" @@ -635,6 +638,9 @@ PrefsDlg::PrefsDlg (){ m_bSelectCurves = TRUE; m_bSelectModels = TRUE; m_nEntityShowState = ENTITY_SKINNED_BOXED; + m_bFixedTextureSize = TRUE; + m_nFixedTextureSizeWidth = 64; + m_nFixedTextureSizeHeight = 64; m_nTextureScale = 2; m_bSwitchClip = FALSE; m_bSelectWholeEntities = TRUE; @@ -1581,6 +1587,7 @@ void PrefsDlg::BuildDialog(){ // Main Preferences dialog GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel; GtkWidget *startup_label, *tcomp_label, *startup_combo, *tcomp_combo; + GtkWidget *ftw_label, *fth_label; // Widgets on notebook pages GtkWidget *check, *label, *scale, *hbox2, *combo, *table, *spin, *entry, *pixmap, @@ -2119,6 +2126,43 @@ void PrefsDlg::BuildDialog(){ AddDialogData( combo, &m_nLatchedShader, DLG_COMBO_BOX_INT ); g_list_free( combo_list ); + check = gtk_check_button_new_with_label( _( "Use Fixed Texture Size" ) ); + gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); + AddDialogData( check, &m_bFixedTextureSize, DLG_CHECK_BOOL ); + + hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); + gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); + + ftw_label = label = gtk_label_new( _( "Fixed Texture Wdith" ) ); + gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); + + spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 1024, 1, 10, 0 ) ), 1, 0 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + g_object_set( spin, "xalign", 1.0, NULL ); + gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, FALSE, 0 ); + gtk_widget_show( spin ); + AddDialogData( spin, &m_nFixedTextureSizeWidth, DLG_SPIN_INT ); + + hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); + gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); + + fth_label = label = gtk_label_new( _( "Fixed Texture Height" ) ); + gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); + + spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 1024, 1, 10, 0 ) ), 1, 0 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + g_object_set( spin, "xalign", 1.0, NULL ); + gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, FALSE, 0 ); + gtk_widget_show( spin ); + AddDialogData( spin, &m_nFixedTextureSizeHeight, DLG_SPIN_INT ); + size_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL ); gtk_size_group_add_widget( size_group, tcomp_label ); gtk_size_group_add_widget( size_group, startup_label ); @@ -2129,6 +2173,11 @@ void PrefsDlg::BuildDialog(){ gtk_size_group_add_widget( size_group, startup_combo ); g_object_unref( size_group ); + size_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL ); + gtk_size_group_add_widget( size_group, ftw_label ); + gtk_size_group_add_widget( size_group, fth_label ); + g_object_unref( size_group ); + // Add the page to the notebook gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); @@ -3017,6 +3066,10 @@ void PrefsDlg::LoadPrefs(){ m_nShader = m_nLatchedShader; + mLocalPrefs.GetPref( FIXEDTEXSIZE_KEY, &m_bFixedTextureSize, FALSE ); + mLocalPrefs.GetPref( FIXEDTEXSIZEWIDTH_KEY, &m_nFixedTextureSizeWidth, 64 ); + mLocalPrefs.GetPref( FIXEDTEXSIZEHEIGHT_KEY, &m_nFixedTextureSizeHeight, 64 ); + mLocalPrefs.GetPref( SHOWTEXDIRLIST_KEY, &m_bShowTexDirList, TRUE ); mLocalPrefs.GetPref( NOCLAMP_KEY, &m_bNoClamp, FALSE ); diff --git a/radiant/preferences.h b/radiant/preferences.h index ff560da9..27558c18 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -645,6 +645,9 @@ int m_nCubicScale; bool m_bSelectCurves; bool m_bSelectModels; int m_nEntityShowState; +bool m_bFixedTextureSize; +int m_nFixedTextureSizeWidth; +int m_nFixedTextureSizeHeight; int m_nTextureScale; bool m_bNormalizeColors; bool m_bSwitchClip; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index f8dc517b..58ff312f 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1613,9 +1613,14 @@ void Texture_Draw( int width, int height ){ break; } - nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); - nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); - + if( g_PrefsDlg.m_bFixedTextureSize && g_PrefsDlg.m_nFixedTextureSizeWidth > 0 && g_PrefsDlg.m_nFixedTextureSizeHeight > 0 ) + { + nWidth = g_PrefsDlg.m_nFixedTextureSizeWidth; + nHeight = g_PrefsDlg.m_nFixedTextureSizeHeight; + } else { + nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + } if ( y != last_y ) { last_y = y; last_height = 0; From 39405afcb0b3717002d4ac64c92a8999f8459712 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 29 Sep 2015 20:54:54 +0200 Subject: [PATCH 09/27] Fix another crash --- plugins/map/parse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/map/parse.cpp b/plugins/map/parse.cpp index 953bdd95..744499ef 100644 --- a/plugins/map/parse.cpp +++ b/plugins/map/parse.cpp @@ -202,7 +202,7 @@ void Patch_Parse( patchMesh_t *pPatch ){ GetToken( true ); str = new char[strlen( token ) + 10]; strcpy( str, "textures/" ); - Q_strncpyz( str + 9, token, sizeof( str ) - 9 ); + Q_strncpyz( str + 9, token, strlen( token ) + 10 - 9 ); pPatch->pShader = QERApp_Shader_ForName( str ); pPatch->d_texture = pPatch->pShader->getTexture(); delete [] str; From 401dc19c395441a3589f6f4c712baba7c1a36c34 Mon Sep 17 00:00:00 2001 From: Ensiform Date: Tue, 29 Sep 2015 16:55:01 -0500 Subject: [PATCH 10/27] Jedi Academy misc_model_static support for radiant. This patch adds misc_model_static model rendering for radiant and tidies up the string check code for model classnames in a couple of places. --- radiant/eclass_def.cpp | 4 +++- radiant/filters.cpp | 2 ++ radiant/xywindow.cpp | 24 +++++++++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/radiant/eclass_def.cpp b/radiant/eclass_def.cpp index 7db391c5..b46c9b85 100644 --- a/radiant/eclass_def.cpp +++ b/radiant/eclass_def.cpp @@ -121,6 +121,8 @@ void setSpecialLoad( eclass_t *e, const char* pWhat, char*& p ){ } } +qboolean IsModelEntity( const char *name ); + eclass_t *Eclass_InitFromText( char *text ){ char *t; int len; @@ -253,7 +255,7 @@ eclass_t *Eclass_InitFromText( char *text ){ if ( strcmpi( e->name, "path" ) == 0 ) { e->nShowFlags |= ECLASS_PATH; } - if ( strcmpi( e->name, "misc_model" ) == 0 ) { + if ( IsModelEntity( e->name ) == qtrue ) { e->nShowFlags |= ECLASS_MISCMODEL; } diff --git a/radiant/filters.cpp b/radiant/filters.cpp index 1b909db8..7a59b0e4 100644 --- a/radiant/filters.cpp +++ b/radiant/filters.cpp @@ -141,6 +141,8 @@ bfilter_t *FilterAddBase( bfilter_t *pFilter ){ pFilter = FilterAddImpl( pFilter,3,0,"trigger",EXCLUDE_TRIGGERS,true ); pFilter = FilterAddImpl( pFilter,3,0,"misc_model",EXCLUDE_MODELS,true ); pFilter = FilterAddImpl( pFilter,3,0,"misc_gamemodel",EXCLUDE_MODELS,true ); + pFilter = FilterAddImpl( pFilter,3,0,"misc_model_static",EXCLUDE_MODELS,true ); + pFilter = FilterAddImpl( pFilter,3,0,"model_static",EXCLUDE_MODELS,true ); pFilter = FilterAddImpl( pFilter,4,ECLASS_LIGHT,NULL,EXCLUDE_LIGHTS,true ); pFilter = FilterAddImpl( pFilter,4,ECLASS_PATH,NULL,EXCLUDE_PATHS,true ); pFilter = FilterAddImpl( pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID,true ); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index c8734cc0..5a9616ab 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -356,6 +356,28 @@ void DrawPathLines( void ){ extern void AssignModel(); +static const char *model_classnames[] = +{ + "misc_model", + "misc_model_static", + "misc_gamemodel", + "model_static", +}; + +static const size_t model_classnames_count = sizeof( model_classnames ) / sizeof( *model_classnames ); + +qboolean IsModelEntity( const char *name ) +{ + for ( size_t i = 0; i < model_classnames_count; i++ ) + { + if ( stricmp( name, model_classnames[i] ) == 0 ) + { + return qtrue; + } + } + return qfalse; +} + void CreateEntityFromName( const char* name, const vec3_t origin ){ entity_t *e; brush_t* b; @@ -431,7 +453,7 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){ } Select_Brush( e->brushes.onext ); - if ( ( stricmp( name, "misc_model" ) == 0 ) || ( stricmp( name, "misc_gamemodel" ) == 0 ) || ( strcmpi( name, "model_static" ) == 0 ) ) { + if ( IsModelEntity( name ) == qtrue ) { SetInspectorMode( W_ENTITY ); AssignModel(); } From cbab8835f9ee04dc3ad60329202335c8605520db Mon Sep 17 00:00:00 2001 From: Ensiform Date: Tue, 29 Sep 2015 18:35:44 -0500 Subject: [PATCH 11/27] C++11 and newer reserves X"foo" and "bar"Y for string literal syntax. This patch fixes the instances that were found by MSVC 2015 compiling so far. --- radiant/preferences.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index e3b0f66d..553b58b5 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -724,7 +724,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ // on win32, game tools path can now be specified relative to the exe's cwd prop = (char*)xmlGetProp( pNode, (xmlChar*)TOOLS_ATTRIBUTE ); if ( prop == NULL ) { - Error( "Didn't find '"TOOLS_ATTRIBUTE "' node in the game description file '%s'\n", pDoc->URL ); + Error( "Didn't find '" TOOLS_ATTRIBUTE "' node in the game description file '%s'\n", pDoc->URL ); } { char full[PATH_MAX]; @@ -3605,11 +3605,11 @@ void CGameInstall::Run() { // - TTimo fprintf( fg, "\n 0 ) { - fprintf( fg, " "EXECUTABLES_ATTRIBUTE "=\"%s\"\n", m_strExecutables.GetBuffer() ); + fprintf( fg, " " EXECUTABLES_ATTRIBUTE "=\"%s\"\n", m_strExecutables.GetBuffer() ); } switch ( m_availGames[ m_nComboSelect ] ) { @@ -3708,9 +3708,9 @@ void CGameInstall::Run() { } case GAME_ET: { #ifdef _WIN32 - fprintf( fg, " "ENGINE_ATTRIBUTE "=\"ET.exe\"\n"); + fprintf( fg, " " ENGINE_ATTRIBUTE "=\"ET.exe\"\n"); #elif __linux__ - fprintf( fg, " "ENGINE_ATTRIBUTE "=\"et\"\n" ); + fprintf( fg, " " ENGINE_ATTRIBUTE "=\"et\"\n" ); #endif fprintf( fg, " prefix=\".etwolf\"\n" ); fprintf( fg, " basegame=\"etmain\"\n" ); From 57138ae6e5a2b067603bda68ed852c31f5b619fb Mon Sep 17 00:00:00 2001 From: Pan7 Date: Wed, 30 Sep 2015 18:50:19 +0200 Subject: [PATCH 12/27] Hollow Touch update, thx Garux --- radiant/csg.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/radiant/csg.cpp b/radiant/csg.cpp index fa8ef757..4977161a 100644 --- a/radiant/csg.cpp +++ b/radiant/csg.cpp @@ -62,18 +62,21 @@ void CSG_MakeHollowMode( int mode ){ split = *f; VectorScale( f->plane.normal, g_qeglobals.d_gridsize, move ); for ( i = 0 ; i < 3 ; i++ ) - VectorSubtract( split.planepts[i], move, split.planepts[i] ); - + if( mode == CSG_HOLLOW_MODE_TOUCH ) { + VectorAdd( f->planepts[i], move, f->planepts[i] ); + } else { + VectorSubtract( split.planepts[i], move, split.planepts[i] ); + } Brush_SplitBrushByFace( b, &split, &front, &back ); if ( back ) { Brush_Free( back ); } if ( front ) { - if( mode == CSG_HOLLOW_MODE_TOUCH ) { - Brush_Move( front, move, true ); - } Brush_AddToList( front, &selected_brushes ); } + if( mode == CSG_HOLLOW_MODE_TOUCH ) { + *f = split; + } } Brush_Free( b ); } From e09ed3bffde4317655c11d6990a8bae5c07cc39a Mon Sep 17 00:00:00 2001 From: Pan7 Date: Thu, 1 Oct 2015 17:56:00 +0200 Subject: [PATCH 13/27] usemtl for obj models --- libs/picomodel/pm_obj.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libs/picomodel/pm_obj.c b/libs/picomodel/pm_obj.c index 1c8c088f..2f6e93c4 100644 --- a/libs/picomodel/pm_obj.c +++ b/libs/picomodel/pm_obj.c @@ -49,7 +49,6 @@ * - '_obj_load' code crashes in a weird way after * '_obj_mtl_load' for a few .mtl files * - process 'mtllib' rather than using .mtl - * - handle 'usemtl' statements */ /* uncomment when debugging this module */ /* #define DEBUG_PM_OBJ */ @@ -859,6 +858,22 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){ /* increase vertex count */ curVertex += max; } + + } + else if ( !_pico_stricmp( p->token, "usemtl" ) ) { + char *materialName; + materialName = _pico_parse( p, 0 ); + if( materialName || strlen( materialName ) ) { + picoShader_t *shader; + shader = PicoFindShader( model, materialName, 0 ); + if( !shader ) { + shader = PicoNewShader( model ); + PicoSetShaderName( shader, materialName ); + } + if( shader && curSurface ) { + PicoSetSurfaceShader( curSurface, shader ); + } + } } /* skip unparsed rest of line and continue */ _pico_parse_skip_rest( p ); From cb00cebbb49c7893fc2bcfb3ab5006eb65d443e1 Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Sat, 3 Oct 2015 00:01:48 +0200 Subject: [PATCH 14/27] DisplaySizeInfo --- radiant/xywindow.cpp | 82 ++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index c8734cc0..70c4e885 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -1156,24 +1156,24 @@ void XYWnd::OnMouseMove( guint32 nFlags, int pointx, int pointy ){ update_xor_rectangle_xy( m_XORRectangle ); } -void XYWnd::OnMouseWheel( bool bUp, int pointx, int pointy ){ +void XYWnd::OnMouseWheel( bool bUp, int pointx, int pointy ) { if ( bUp ) { - if ( g_PrefsDlg.m_bMousewheelZoom == TRUE ) { - // improved zoom-in - // frame coverges to part of window where the cursor currently resides - float old_scale = m_fScale; - g_pParentWnd->OnViewZoomin(); - float scale_diff = 1.0 / old_scale - 1.0 / m_fScale; - int nDim1 = ( m_nViewType == YZ ) ? 1 : 0; - int nDim2 = ( m_nViewType == XY ) ? 1 : 2; - m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth); - m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight); - } - else{ - g_pParentWnd->OnViewZoomin(); - } + if ( g_PrefsDlg.m_bMousewheelZoom == TRUE ) { + // improved zoom-in + // frame coverges to part of window where the cursor currently resides + float old_scale = m_fScale; + g_pParentWnd->OnViewZoomin(); + float scale_diff = 1.0 / old_scale - 1.0 / m_fScale; + int nDim1 = ( m_nViewType == YZ ) ? 1 : 0; + int nDim2 = ( m_nViewType == XY ) ? 1 : 2; + m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth); + m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight); + } + else { + g_pParentWnd->OnViewZoomin(); + } } - else{ + else { g_pParentWnd->OnViewZoomout(); } @@ -1458,16 +1458,16 @@ void XYWnd::HandleDrop(){ menu_separator( menu ); nID++; // NOTE: temporary commented out until we put it back in for good (that is with actual features) /* - menu_in_menu = create_menu_in_menu_with_mnemonic (menu, "Group",); - create_menu_item_with_mnemonic (menu_in_menu, "Add to...", - GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_ADDTO); - create_menu_item_with_mnemonic (menu_in_menu, "Remove", - GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_REMOVE); - create_menu_item_with_mnemonic (menu_in_menu, "Name...", - GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_NAME); - menu_separator (menu_in_menu); nID++; - create_menu_item_with_mnemonic (menu_in_menu, "New Group...", - GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_NEWGROUP); + menu_in_menu = create_menu_in_menu_with_mnemonic (menu, "Group",); + create_menu_item_with_mnemonic (menu_in_menu, "Add to...", + GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_ADDTO); + create_menu_item_with_mnemonic (menu_in_menu, "Remove", + GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_REMOVE); + create_menu_item_with_mnemonic (menu_in_menu, "Name...", + GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_NAME); + menu_separator (menu_in_menu); nID++; + create_menu_item_with_mnemonic (menu_in_menu, "New Group...", + GTK_SIGNAL_FUNC (HandleCommand), ID_DROP_GROUP_NEWGROUP); */ create_menu_item_with_mnemonic( menu, "Ungroup Entity", GTK_SIGNAL_FUNC( HandleCommand ), ID_SELECTION_UNGROUPENTITY ); @@ -2113,16 +2113,15 @@ void XYWnd::XY_DrawGrid(){ int step, stepx, stepy, colour; step = stepx = stepy = MAX( 64, (int)g_qeglobals.d_gridsize ); - /* - int stepSize = (int)(8 / m_fScale); - if (stepSize > step) - { - int i; - for (i = 1; i < stepSize; i <<= 1) - ; - step = i; - } - */ +/* + int stepSize = (int)(8 / m_fScale); + if (stepSize > step) + { + int i; + for (i = 1; i < stepSize; i <<= 1); + step = i; + } +*/ //Sys_Printf("scale: %f\n", m_fScale); //Sys_Printf("step before: %i\n", step); @@ -2250,8 +2249,9 @@ void XYWnd::XY_DrawGrid(){ // Pixels between left of label and // - left of grid view window (for horizontal grid line label) or // - drawn vertical grid line (for vertical grid line label). - const int pixelsLeftCushion = 2; // IMPORTANT! Must be at least 1 otherwise labels might not be drawn - // because the origin of the text might be off screen due to rounding. + // IMPORTANT! Must be at least 1 otherwise labels might not be drawn, + // because the origin of the text might be off screen due to rounding + const int pixelsLeftCushion = 2; // Pixels between baseline of horizontal grid line label and drawn horizontal grid line. const int pixelsButtomCushion = 2; @@ -2573,8 +2573,8 @@ void XYWnd::DrawZIcon( void ){ // can be greatly simplified but per usual i am in a hurry // which is not an excuse, just a fact void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds ){ - const char* g_pDimStrings[] = {"x:%.f", "y:%.f", "z:%.f"}; - const char* g_pOrgStrings[] = {"(x:%.f y:%.f)", "(x:%.f z:%.f)", "(y:%.f z:%.f)"}; + const char* g_pDimStrings[] = {"x: %.f", "y: %.f", "z: %.f"}; + const char* g_pOrgStrings[] = {"(x: %.f, y: %.f)", "(x: %.f, z: %.f)", "(y: %.f, z: %.f)"}; CString g_strDim; @@ -2609,7 +2609,7 @@ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxB qglEnd(); - qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 20.0 / m_fScale, 0.0f ); + qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 25.0 / m_fScale, 0.0f ); g_strDim.Format( g_pDimStrings[nDim1], vSize[nDim1] ); gtk_glwidget_print_string( (char *) g_strDim.GetBuffer() ); From e1bfb50c24a5bb3d7b23ed2d3f645da2df896809 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 3 Oct 2015 15:24:49 +0200 Subject: [PATCH 15/27] Surface/Patch Inspector dialog expand/fill updates --- plugins/surface/surfacedialog.cpp | 94 +++++---- plugins/surface_idtech2/surfacedialog.cpp | 144 ++++++++------ plugins/surface_idtech2/surfaceflags.cpp | 33 ++-- radiant/patchdialog.cpp | 49 +++-- radiant/surfacedialog.cpp | 231 +++++++++++----------- 5 files changed, 299 insertions(+), 252 deletions(-) diff --git a/plugins/surface/surfacedialog.cpp b/plugins/surface/surfacedialog.cpp index 0fd4ebe0..0ff9bc39 100644 --- a/plugins/surface/surfacedialog.cpp +++ b/plugins/surface/surfacedialog.cpp @@ -627,17 +627,13 @@ GtkWidget* create_SurfaceInspector( void ){ GtkWidget *label; - GtkWidget *viewport9; - GtkWidget *viewport2; - GtkWidget *viewport4; - GtkWidget *viewport7; - GtkWidget *viewport5; + GtkWidget *viewport; GtkWidget *table1; GtkWidget *table4; GtkWidget *table5; - GtkWidget *vbox7; + GtkWidget *content_area; GtkWidget *hbox1, *hbox2; @@ -649,20 +645,22 @@ GtkWidget* create_SurfaceInspector( void ){ SetWinPos_from_Prefs( SurfaceInspector ); - vbox7 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); - gtk_container_add( GTK_CONTAINER( SurfaceInspector ), vbox7 ); - gtk_widget_show( vbox7 ); + content_area = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); + gtk_container_add( GTK_CONTAINER( SurfaceInspector ), content_area ); + gtk_widget_show( content_area ); - viewport9 = gtk_frame_new( NULL ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 ); - gtk_frame_set_shadow_type( GTK_FRAME( viewport9 ), GTK_SHADOW_ETCHED_IN ); - gtk_widget_show( viewport9 ); + viewport = gtk_frame_new( NULL ); + gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_ETCHED_IN ); + gtk_box_pack_start( GTK_BOX( content_area ), viewport, FALSE, FALSE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( viewport ), 2 ); + gtk_widget_set_hexpand( viewport, TRUE ); + gtk_widget_set_vexpand( viewport, FALSE ); + gtk_widget_show( viewport ); hbox1 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); - gtk_widget_show( hbox1 ); - gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 ); + gtk_container_add( GTK_CONTAINER( viewport ), hbox1 ); gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); + gtk_widget_show( hbox1 ); label = gtk_label_new( _( "Texture: " ) ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); @@ -677,17 +675,19 @@ GtkWidget* create_SurfaceInspector( void ){ gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 ); gtk_widget_show( texture_combo_entry ); - viewport2 = gtk_frame_new( NULL ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, TRUE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 ); - gtk_frame_set_shadow_type( GTK_FRAME( viewport2 ), GTK_SHADOW_ETCHED_IN ); - gtk_widget_show( viewport2 ); + viewport = gtk_frame_new( NULL ); + gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_ETCHED_IN ); + gtk_box_pack_start( GTK_BOX( content_area ), viewport, FALSE, TRUE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( viewport ), 2 ); + gtk_widget_set_hexpand( viewport, TRUE ); + gtk_widget_set_vexpand( viewport, TRUE ); + gtk_widget_show( viewport ); table1 = gtk_grid_new(); gtk_widget_set_hexpand( table1, TRUE ); gtk_widget_set_vexpand( table1, TRUE ); gtk_grid_set_column_spacing( GTK_GRID( table1 ), 5 ); - gtk_container_add( GTK_CONTAINER( viewport2 ), table1 ); + gtk_container_add( GTK_CONTAINER( viewport ), table1 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); gtk_widget_show( table1 ); @@ -824,58 +824,66 @@ GtkWidget* create_SurfaceInspector( void ){ g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); - viewport7 = gtk_frame_new( NULL ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, TRUE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 ); - gtk_frame_set_shadow_type( GTK_FRAME( viewport7 ), GTK_SHADOW_ETCHED_IN ); - gtk_widget_show( viewport7 ); + viewport = gtk_frame_new( NULL ); + gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_ETCHED_IN ); + gtk_box_pack_start( GTK_BOX( content_area ), viewport, FALSE, TRUE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( viewport ), 2 ); + gtk_widget_set_hexpand( viewport, TRUE ); + gtk_widget_set_vexpand( viewport, FALSE ); + gtk_widget_show( viewport ); hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); - gtk_container_add( GTK_CONTAINER( viewport7 ), hbox2 ); + gtk_container_add( GTK_CONTAINER( viewport ), hbox2 ); gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 4 ); + gtk_widget_set_hexpand( hbox2, FALSE ); + gtk_widget_set_vexpand( hbox2, FALSE ); gtk_widget_show( hbox2 ); - viewport4 = gtk_frame_new( NULL ); //only need this for layout - gtk_container_add( GTK_CONTAINER( hbox2 ), viewport4 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport4 ), 6 ); - gtk_frame_set_shadow_type( GTK_FRAME( viewport4 ), GTK_SHADOW_NONE ); - gtk_widget_show( viewport4 ); + viewport = gtk_frame_new( NULL ); //only need this for layout + gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_NONE ); + gtk_container_add( GTK_CONTAINER( hbox2 ), viewport ); + gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 ); + gtk_widget_set_hexpand( viewport, FALSE ); + gtk_widget_set_vexpand( viewport, FALSE ); + gtk_widget_show( viewport ); table4 = gtk_grid_new(); //only need this for layout - gtk_container_add( GTK_CONTAINER( viewport4 ), table4 ); + gtk_container_add( GTK_CONTAINER( viewport ), table4 ); gtk_container_set_border_width( GTK_CONTAINER( table4 ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table4 ), 2 ); gtk_widget_show( table4 ); label = gtk_label_new( "" ); //only need this for layout - gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_grid_attach( GTK_GRID( table4 ), label, 0, 0, 1, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) ); gtk_grid_attach( GTK_GRID( table4 ), axial_button, 0, 1, 1, 1 ); gtk_widget_show( axial_button ); - viewport5 = gtk_frame_new( NULL ); - gtk_box_pack_start( GTK_BOX( hbox2 ), viewport5, FALSE, FALSE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 ); - gtk_frame_set_shadow_type( GTK_FRAME( viewport5 ), GTK_SHADOW_ETCHED_OUT ); - gtk_widget_show( viewport5 ); + viewport = gtk_frame_new( NULL ); + gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_ETCHED_OUT ); + gtk_box_pack_start( GTK_BOX( hbox2 ), viewport, FALSE, FALSE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 ); + gtk_widget_set_hexpand( viewport, FALSE ); + gtk_widget_set_vexpand( viewport, FALSE ); + gtk_widget_show( viewport ); table5 = gtk_grid_new(); - gtk_container_add( GTK_CONTAINER( viewport5 ), table5 ); + gtk_container_add( GTK_CONTAINER( viewport ), table5 ); gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table5 ), 2 ); gtk_widget_show( table5 ); label = gtk_label_new( _( "Height" ) ); - gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_grid_attach( GTK_GRID( table5 ), label, 1, 0, 1, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( _( "Width" ) ); - gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_grid_attach( GTK_GRID( table5 ), label, 2, 0, 1, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) ); diff --git a/plugins/surface_idtech2/surfacedialog.cpp b/plugins/surface_idtech2/surfacedialog.cpp index 6ceaa5de..d88ec67f 100644 --- a/plugins/surface_idtech2/surfacedialog.cpp +++ b/plugins/surface_idtech2/surfacedialog.cpp @@ -543,16 +543,16 @@ GtkWidget* create_SurfaceInspector( void ){ GtkWidget *label; GtkAdjustment *adjustment; - + GtkSizeGroup *size_group; GtkWidget *table1; GtkWidget *table2; GtkWidget *frame1; GtkWidget *frame2; - + GtkWidget *vbox1; GtkWidget *hbox1; - + SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), "Surface Inspector" ); @@ -560,234 +560,262 @@ GtkWidget* create_SurfaceInspector( void ){ SetWinPos_from_Prefs( SurfaceInspector ); vbox1 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 5 ); - gtk_widget_show( vbox1 ); gtk_container_add( GTK_CONTAINER( SurfaceInspector ), vbox1 ); + gtk_widget_show( vbox1 ); hbox1 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); - gtk_widget_show( hbox1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), hbox1 ); gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); + gtk_widget_show( hbox1 ); label = gtk_label_new( "Texture: " ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); texture_combo = gtk_combo_box_text_new(); + //gtk_combo_disable_activate( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( texture_combo ) ); + gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); + gtk_widget_show( texture_combo ); g_object_set_data( G_OBJECT( gtk_combo_box_get_popup_accessible( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT(texture_combo ) ) ) ), "KeepMeAround", texture_combo ); - //gtk_combo_disable_activate( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( texture_combo ) ); - gtk_widget_show( texture_combo ); - gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); texture_combo_entry = gtk_bin_get_child( GTK_BIN( texture_combo ) ); - gtk_widget_show( texture_combo_entry ); gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 1024 ); + gtk_widget_show( texture_combo_entry ); frame1 = gtk_frame_new( "Surface" ); - gtk_widget_show( frame1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 ); + gtk_widget_show( frame1 ); table1 = gtk_table_new( 7, 3, FALSE ); - gtk_widget_show( table1 ); gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table1 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); gtk_container_add( GTK_CONTAINER( frame1 ), table1 ); + gtk_widget_show( table1 ); label = gtk_label_new( "Step" ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Value" ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Horizontal shift: " ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Vertical shift: " ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Horizontal scale: " ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Vertical scale: " ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Rotate: " ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 5, 6, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); // Value Spins adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( hshift_value_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); + gtk_widget_show( hshift_value_spinbutton ); + g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL ); + adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( vshift_value_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); + gtk_widget_show( vshift_value_spinbutton ); + g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( hscale_value_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); + gtk_widget_show( hscale_value_spinbutton ); + g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( vscale_value_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( vscale_value_spinbutton ); + g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( rotate_value_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 5, 6, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); + gtk_widget_show( rotate_value_spinbutton ); + g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL ); // Step Spins adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( hshift_step_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( hshift_step_spinbutton ); + g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( vshift_step_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 2, 3, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( vshift_step_spinbutton ); + g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( hscale_step_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( hscale_step_spinbutton ); + g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( vscale_step_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 2, 3, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( vscale_step_spinbutton ); + g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( rotate_step_spinbutton ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 2, 3, 5, 6, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( rotate_step_spinbutton ); + g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" ); - gtk_widget_show( match_grid_button ); gtk_table_attach( GTK_TABLE( table1 ), match_grid_button, 2, 3, 6, 7, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( match_grid_button ); frame2 = gtk_frame_new( "Tools" ); - gtk_widget_show( frame2 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 ); + gtk_widget_show( frame2 ); table2 = gtk_table_new( 2, 4, TRUE ); - gtk_widget_show( table2 ); gtk_table_set_col_spacings( GTK_TABLE( table2), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table2 ), 0 ); gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); gtk_container_add( GTK_CONTAINER( frame2 ), table2 ); + gtk_widget_show( table2 ); label = gtk_label_new( "Height" ); gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Width" ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Brush" ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); - gtk_widget_show( fit_height_spinbutton ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table2 ), fit_height_spinbutton, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( fit_height_spinbutton ); + g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); - gtk_widget_show( fit_width_spinbutton ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_table_attach( GTK_TABLE( table2 ), fit_width_spinbutton, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_show( fit_width_spinbutton ); + g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL ); fit_button = gtk_button_new_with_mnemonic( "Fit" ); - gtk_widget_show( fit_button ); gtk_table_attach( GTK_TABLE( table2 ), fit_button, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( fit_button ); axial_button = gtk_button_new_with_mnemonic( "Axial" ); - gtk_widget_show( axial_button ); gtk_table_attach( GTK_TABLE( table2 ), axial_button, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( axial_button ); + + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, axial_button ); + gtk_size_group_add_widget( size_group, fit_button ); + g_object_unref( size_group ); // Add the SURF_ and CONTENTS_ flags frame create_SurfaceFlagsFrame( vbox1 ); diff --git a/plugins/surface_idtech2/surfaceflags.cpp b/plugins/surface_idtech2/surfaceflags.cpp index 1affb160..b388a2ef 100644 --- a/plugins/surface_idtech2/surfaceflags.cpp +++ b/plugins/surface_idtech2/surfaceflags.cpp @@ -304,28 +304,28 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ char buffer[16]; frame1 = gtk_frame_new( _( "Flags" ) ); - gtk_widget_show( frame1 ); gtk_container_add( GTK_CONTAINER( surfacedialog_widget ), frame1 ); + gtk_widget_show( frame1 ); vbox1 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); - gtk_widget_show( vbox1 ); gtk_container_add( GTK_CONTAINER( frame1 ), vbox1 ); + gtk_widget_show( vbox1 ); notebook1 = gtk_notebook_new(); - gtk_widget_show( notebook1 ); gtk_box_pack_start( GTK_BOX( vbox1 ), notebook1, TRUE, TRUE, 0 ); gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook1 ), TRUE ); gtk_container_set_border_width( GTK_CONTAINER( notebook1 ), 5 ); + gtk_widget_show( notebook1 ); vbox2 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 5 ); - gtk_widget_show( vbox2 ); gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 ); + gtk_widget_show( vbox2 ); table4 = gtk_table_new( 8, 4, TRUE ); - gtk_widget_show( table4 ); gtk_table_set_col_spacings( GTK_TABLE( table4 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table4 ), 5 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table4, TRUE, TRUE, 0 ); + gtk_widget_show( table4 ); y = -1; for ( i = 0; i < MAX_BUTTONS; i++ ) { @@ -345,20 +345,21 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ } hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); hbox3 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); - gtk_widget_show( hbox3 ); gtk_box_pack_start( GTK_BOX( hbox2 ), hbox3, TRUE, TRUE, 0 ); + gtk_widget_show( hbox3 ); vbox4 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); - gtk_widget_show( vbox4 ); gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 ); + gtk_widget_show( vbox4 ); - value_label = gtk_label_new( " Value: " ); - gtk_widget_show( value_label ); + value_label = gtk_label_new( "Value: " ); gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 ); + gtk_widget_set_halign( value_label, GTK_ALIGN_START ); + gtk_widget_show( value_label ); value_entry = gtk_entry_new(); g_signal_connect( value_entry, "changed", @@ -368,22 +369,23 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ G_CALLBACK( on_value_entry_insert_text ), NULL ); gtk_entry_set_max_length( (GtkEntry *)value_entry, 11 ); - gtk_widget_show( value_entry ); gtk_box_pack_start( GTK_BOX( hbox3 ), value_entry, TRUE, TRUE, 0 ); + gtk_widget_show( value_entry ); + g_object_set( value_entry, "xalign", 1.0, NULL ); vbox3 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); - gtk_widget_show( vbox3 ); gtk_box_pack_start( GTK_BOX( hbox3 ), vbox3, TRUE, TRUE, 0 ); + gtk_widget_show( vbox3 ); label5 = gtk_label_new( "Surface Flags" ); - gtk_widget_show( label5 ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label5 ); + gtk_widget_show( label5 ); table3 = gtk_table_new( 8, 4, TRUE ); - gtk_widget_show( table3 ); gtk_table_set_col_spacings( GTK_TABLE( table3 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table3 ), 5 ); gtk_container_add( GTK_CONTAINER( notebook1 ), table3 ); + gtk_widget_show( table3 ); y = -1; for ( i = 0; i < MAX_BUTTONS; i++ ) { @@ -395,14 +397,15 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer ); content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); g_signal_connect( content_buttons[i], "toggled", G_CALLBACK( on_content_button_toggled ), GINT_TO_POINTER( 1 << i ) ); - gtk_widget_show( content_buttons[i] ); gtk_table_attach( GTK_TABLE( table3 ), content_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( content_buttons[i] ); } label6 = gtk_label_new( "Content Flags" ); gtk_widget_show( label6 ); + gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 1 ), label6 ); return frame1; diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 3d0e43dd..d5afd3a7 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -307,27 +307,29 @@ void PatchDialog::BuildDialog(){ vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); hbox = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); + gtk_widget_show( hbox ); frame = gtk_frame_new( _( "Details" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); vbox2 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 5 ); - gtk_widget_show( vbox2 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); + gtk_widget_set_vexpand( vbox2, FALSE ); + gtk_widget_show( vbox2 ); table = gtk_grid_new(); - gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox2 ), table, FALSE, TRUE, 0 ); gtk_grid_set_row_spacing( GTK_GRID( table ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table ), 5 ); + gtk_widget_set_hexpand( table, TRUE ); gtk_widget_show( table ); row_label = label = gtk_label_new( _( "Row:" ) ); @@ -382,26 +384,31 @@ void PatchDialog::BuildDialog(){ label = gtk_label_new( _( "X:" ) ); gtk_grid_attach( GTK_GRID( table ), label, 0, 0, 1, 1 ); gtk_widget_set_tooltip_text( label, _( "X-Axis" ) ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( _( "Y:" ) ); gtk_grid_attach( GTK_GRID( table ), label, 0, 1, 1, 1 ); gtk_widget_set_tooltip_text( label, _( "Y-Axis" ) ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( _( "Z:" ) ); gtk_grid_attach( GTK_GRID( table ), label, 0, 2, 1, 1 ); gtk_widget_set_tooltip_text( label, _( "Z-Axis" ) ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( _( "S:" ) ); gtk_grid_attach( GTK_GRID( table ), label, 0, 3, 1, 1 ); gtk_widget_set_tooltip_text( label, _( "S-coordinates correspond to the \"x\" coordinates on the texture itself" ) ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( _( "T:" ) ); gtk_grid_attach( GTK_GRID( table ), label, 0, 4, 1, 1 ); gtk_widget_set_tooltip_text( label, _( "T-coordinates correspond to the \"y\" coordinates on the texture itself. The measurements are in game units." ) ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); adj = gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ); @@ -455,29 +462,32 @@ void PatchDialog::BuildDialog(){ AddDialogData( spin, &m_fT, DLG_SPIN_FLOAT ); frame = gtk_frame_new( _( "Texturing" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); vbox2 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 5 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); + gtk_widget_set_vexpand( vbox2, FALSE ); gtk_widget_show( vbox2 ); label = gtk_label_new( _( "Name:" ) ); - gtk_box_pack_start( GTK_BOX( vbox2 ), label, TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox2 ), label, FALSE, TRUE, 0 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); entry = gtk_entry_new(); gtk_editable_set_editable( GTK_EDITABLE( entry ), FALSE ); gtk_widget_show( entry ); - gtk_box_pack_start( GTK_BOX( vbox2 ), entry, TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox2 ), entry, FALSE, TRUE, 0 ); + gtk_widget_set_hexpand( entry, TRUE ); AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT ); table = gtk_grid_new(); - gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox2 ), table, FALSE, TRUE, 0 ); gtk_grid_set_row_spacing( GTK_GRID( table ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table ), 5 ); + gtk_widget_set_hexpand( table, TRUE ); gtk_widget_show( table ); label = gtk_label_new( _( "Value" ) ); @@ -623,27 +633,28 @@ void PatchDialog::BuildDialog(){ g_object_set( spin, "xalign", 1.0, NULL ); hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); + gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_set_hexpand( hbox2, TRUE ); gtk_widget_show( hbox2 ); - gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, TRUE, FALSE, 0 ); cap_button = button = gtk_button_new_with_label( _( "CAP" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchdetails ), NULL ); set_button = button = gtk_button_new_with_label( _( "Set..." ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchreset ), NULL ); nat_button = button = gtk_button_new_with_label( _( "Natural" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchnatural ), NULL ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchfit ), NULL ); size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); @@ -654,20 +665,20 @@ void PatchDialog::BuildDialog(){ g_object_unref( size_group ); hbox = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); + gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); + gtk_widget_set_hexpand( hbox, TRUE ); + gtk_widget_set_vexpand( hbox, FALSE ); gtk_widget_show( hbox ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, FALSE, 0 ); button = gtk_button_new_with_label( _( "Done" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnDone ), NULL ); - gtk_widget_set_size_request( button, 60, -1 ); button = gtk_button_new_with_label( _( "Apply" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnApply ), NULL ); - gtk_widget_set_size_request( button, 60, -1 ); } // sync the dialog our internal data structures diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index b39a678a..2372faf7 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -503,6 +503,8 @@ void SurfaceDlg::InitDefaultIncrement( texdef_t *tex ){ void SurfaceDlg::BuildDialog() { GtkWidget *dlg, *vbox, *hbox2, *frame, *table, *label; GtkWidget *button, *entry, *spin; + GtkWidget *axial_button, *cap_button, *set_button, *nat_button, *fit_button; + GtkSizeGroup *button_group; dlg = m_pWidget; @@ -516,350 +518,345 @@ void SurfaceDlg::BuildDialog() { // replaced by only the vbox: vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); + gtk_widget_show( hbox2 ); label = gtk_label_new( _( "Texture" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); entry = gtk_entry_new(); - g_signal_connect( entry, "key_press_event", G_CALLBACK( OnTextureKey ), NULL ); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( hbox2 ), entry, TRUE, TRUE, 0 ); + gtk_widget_show( entry ); + g_signal_connect( entry, "key_press_event", G_CALLBACK( OnTextureKey ), NULL ); g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry ); // table = gtk_table_new (5, 4, FALSE); table = gtk_table_new( 6, 4, FALSE ); - gtk_widget_show( table ); - gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Horizontal shift" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "hshift", spin ); - g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", - G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( spin, 60, -2 ); + gtk_widget_show( spin ); + g_object_set_data( G_OBJECT( dlg ), "hshift", spin ); + g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", + G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); entry = gtk_entry_new(); - g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry ); - g_signal_connect( entry, "changed", - G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( entry, 50, -2 ); + gtk_widget_show( entry ); + g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry ); + g_signal_connect( entry, "changed", + G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Vertical shift" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "vshift", spin ); - g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", - G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( spin, 60, -2 ); + gtk_widget_show( spin ); + g_object_set_data( G_OBJECT( dlg ), "vshift", spin ); + g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", + G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); entry = gtk_entry_new(); - g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry ); - g_signal_connect( entry, "changed", - G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( entry, 50, -2 ); + gtk_widget_show( entry ); + g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry ); + g_signal_connect( entry, "changed", + G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Horizontal stretch" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "hscale", spin ); - g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", - G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( spin, 60, -2 ); + gtk_widget_show( spin ); + g_object_set_data( G_OBJECT( dlg ), "hscale", spin ); + g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", + G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 2, 3 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); entry = gtk_entry_new(); - g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry ); - g_signal_connect( entry, "changed", - G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 2, 3 ); - gtk_widget_set_size_request( entry, 50, -2 ); + gtk_widget_show( entry ); + g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry ); + g_signal_connect( entry, "changed", + G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Vertical stretch" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "vscale", spin ); - g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", - G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( spin, 60, -2 ); + gtk_widget_show( spin ); + g_object_set_data( G_OBJECT( dlg ), "vscale", spin ); + g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", + G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); entry = gtk_entry_new(); - g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry ); - g_signal_connect( entry, "changed", - G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( entry, 50, -2 ); + gtk_widget_show( entry ); + g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry ); + g_signal_connect( entry, "changed", + G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Rotate" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 0 ) ), 1, 0 ); - g_object_set_data( G_OBJECT( dlg ), "rotate", spin ); - g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", - G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( spin, 60, -2 ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); + g_object_set_data( G_OBJECT( dlg ), "rotate", spin ); + g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", + G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); - gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); entry = gtk_entry_new(); - g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry ); - g_signal_connect( entry, "changed", - G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( entry, 50, -2 ); + gtk_widget_show( entry ); + g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry ); + g_signal_connect( entry, "changed", + G_CALLBACK( OnIncrementChanged ), NULL ); // match grid button button = gtk_button_new_with_label( _( "Match Grid" ) ); - gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnMatchGrid ), NULL ); frame = gtk_frame_new( _( "Texturing" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 4, 4, FALSE ); - gtk_widget_show( table ); - gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( "Brush" ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Patch" ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( "Width" ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); label = gtk_label_new( _( "Height" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); - button = gtk_button_new_with_label( _( "Axial" ) ); - gtk_widget_show( button ); + axial_button = button = gtk_button_new_with_label( _( "Axial" ) ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnAxial ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_widget_show( button ); + fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnFaceFit ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); - button = gtk_button_new_with_label( _( "CAP" ) ); - gtk_widget_show( button ); + button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( button_group, axial_button ); + gtk_size_group_add_widget( button_group, fit_button ); + g_object_unref( button_group ); + + cap_button = button = gtk_button_new_with_label( _( "CAP" ) ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchdetails ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Set..." ) ); - gtk_widget_show( button ); + set_button = button = gtk_button_new_with_label( _( "Set..." ) ); gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchreset ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Natural" ) ); - gtk_widget_show( button ); + nat_button = button = gtk_button_new_with_label( _( "Natural" ) ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchnatural ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_widget_show( button ); + fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchFit ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); + + button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( button_group, cap_button ); + gtk_size_group_add_widget( button_group, set_button ); + gtk_size_group_add_widget( button_group, nat_button ); + gtk_size_group_add_widget( button_group, fit_button ); + g_object_unref( button_group ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( spin, 60, -2 ); + gtk_widget_show( spin ); AddDialogData( spin, &m_nWidth, DLG_SPIN_INT ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( spin, 60, -2 ); + gtk_widget_show( spin ); AddDialogData( spin, &m_nHeight, DLG_SPIN_INT ); hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); + gtk_widget_show( hbox2 ); button = gtk_button_new_with_label( _( "Done" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnDone ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); button = gtk_button_new_with_label( _( "Apply" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnApply ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnCancel ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); // that's a bit of trashy stuff from Textool-v2 branch #ifdef _DEBUG // FIXME: testing only, scaling in BP mode button = gtk_button_new_with_label( _( "Test" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnTest ), NULL ); - gtk_widget_set_size_request( button, 60, -2 ); #endif // Initialize From b0ca831d840dfd622b9837726378e6f06e46e5bf Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 3 Oct 2015 19:26:12 +0200 Subject: [PATCH 16/27] Fix (entity class) def file parsing --- radiant/eclass_def.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radiant/eclass_def.cpp b/radiant/eclass_def.cpp index 7db391c5..755406fb 100644 --- a/radiant/eclass_def.cpp +++ b/radiant/eclass_def.cpp @@ -181,6 +181,9 @@ eclass_t *Eclass_InitFromText( char *text ){ text++; } } + else if ( Get_COM_Token()[0] == '?' ) { + text = t; + } // get the flags From 509a9632a2f638d7f07662af89c2cbbc91f610fd Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sun, 4 Oct 2015 12:12:03 +0200 Subject: [PATCH 17/27] Missing errno.h header --- plugins/vfspk3/vfspk3.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/vfspk3/vfspk3.cpp b/plugins/vfspk3/vfspk3.cpp index 6d479191..4fe6bab5 100644 --- a/plugins/vfspk3/vfspk3.cpp +++ b/plugins/vfspk3/vfspk3.cpp @@ -39,6 +39,7 @@ #endif #include +#include #include "vfspk3.h" #include "vfs.h" From da3a9e609723caeab96f62c649632ec8a1bbe5c2 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 6 Oct 2015 09:56:01 +0200 Subject: [PATCH 18/27] Dialog updates, replacing deprecated tables --- plugins/surface/surfacedialog.cpp | 106 +++++++++----- plugins/surface_idtech2/surfacedialog.cpp | 160 +++++++++------------- plugins/surface_idtech2/surfaceflags.cpp | 31 +++-- radiant/surfacedialog.cpp | 145 ++++++-------------- 4 files changed, 189 insertions(+), 253 deletions(-) diff --git a/plugins/surface/surfacedialog.cpp b/plugins/surface/surfacedialog.cpp index 0ff9bc39..b59843c8 100644 --- a/plugins/surface/surfacedialog.cpp +++ b/plugins/surface/surfacedialog.cpp @@ -629,15 +629,15 @@ GtkWidget* create_SurfaceInspector( void ){ GtkWidget *viewport; - GtkWidget *table1; + GtkWidget *table1, *table3; GtkWidget *table4; GtkWidget *table5; GtkWidget *content_area; - GtkWidget *hbox1, *hbox2; + GtkWidget *hbox1, *hbox2, *hbox3; - GtkSizeGroup *button_group; + GtkSizeGroup *size_group; SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); @@ -689,6 +689,7 @@ GtkWidget* create_SurfaceInspector( void ){ gtk_grid_set_column_spacing( GTK_GRID( table1 ), 5 ); gtk_container_add( GTK_CONTAINER( viewport ), table1 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); + gtk_widget_set_hexpand( GTK_WIDGET( table1 ), TRUE ); gtk_widget_show( table1 ); label = gtk_label_new( _( "Value" ) ); @@ -734,50 +735,50 @@ GtkWidget* create_SurfaceInspector( void ){ // Value Spins hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_set_hexpand( hshift_value_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), hshift_value_spinbutton, 1, 1, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); + gtk_widget_set_hexpand( hshift_value_spinbutton, TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), TRUE ); gtk_widget_show( hshift_value_spinbutton ); g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL ); vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_set_hexpand( vshift_value_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), vshift_value_spinbutton, 1, 2, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); + gtk_widget_set_hexpand( vshift_value_spinbutton, TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), TRUE ); gtk_widget_show( vshift_value_spinbutton ); g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL ); hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_set_hexpand( hscale_value_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), hscale_value_spinbutton, 1, 3, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); + gtk_widget_set_hexpand( hscale_value_spinbutton, TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), TRUE ); gtk_widget_show( hscale_value_spinbutton ); g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL ); vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_set_hexpand( vscale_value_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), vscale_value_spinbutton, 1, 4, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); + gtk_widget_set_hexpand( vscale_value_spinbutton, TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), TRUE ); gtk_widget_show( vscale_value_spinbutton ); g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL ); rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 4 ); - gtk_widget_set_hexpand( rotate_value_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), rotate_value_spinbutton, 1, 5, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); + gtk_widget_set_hexpand( rotate_value_spinbutton, TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), TRUE ); gtk_widget_show( rotate_value_spinbutton ); g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL ); @@ -785,41 +786,41 @@ GtkWidget* create_SurfaceInspector( void ){ // Step Spins hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_set_hexpand( hshift_step_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), hshift_step_spinbutton, 2, 1, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_set_hexpand( hshift_step_spinbutton, TRUE ); gtk_widget_show( hshift_step_spinbutton ); g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL ); vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_set_hexpand( vshift_step_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), vshift_step_spinbutton, 2, 2, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_set_hexpand( vshift_step_spinbutton, TRUE ); gtk_widget_show( vshift_step_spinbutton ); g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL ); hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_set_hexpand( hscale_step_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), hscale_step_spinbutton, 2, 3, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_set_hexpand( hscale_step_spinbutton, TRUE ); gtk_widget_show( hscale_step_spinbutton ); g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL ); vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_set_hexpand( vscale_step_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), vscale_step_spinbutton, 2, 4, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_set_hexpand( vscale_step_spinbutton, TRUE ); gtk_widget_show( vscale_step_spinbutton ); g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL ); rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 4 ); - gtk_widget_set_hexpand( rotate_step_spinbutton, TRUE ); gtk_grid_attach( GTK_GRID( table1 ), rotate_step_spinbutton, 2, 5, 1, 1 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_set_hexpand( rotate_step_spinbutton, TRUE ); gtk_widget_show( rotate_step_spinbutton ); g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); @@ -835,7 +836,7 @@ GtkWidget* create_SurfaceInspector( void ){ hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); gtk_container_add( GTK_CONTAINER( viewport ), hbox2 ); gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 4 ); - gtk_widget_set_hexpand( hbox2, FALSE ); + gtk_widget_set_hexpand( hbox2, TRUE ); gtk_widget_set_vexpand( hbox2, FALSE ); gtk_widget_show( hbox2 ); @@ -843,14 +844,16 @@ GtkWidget* create_SurfaceInspector( void ){ gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_NONE ); gtk_container_add( GTK_CONTAINER( hbox2 ), viewport ); gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 ); - gtk_widget_set_hexpand( viewport, FALSE ); + gtk_widget_set_hexpand( viewport, TRUE ); gtk_widget_set_vexpand( viewport, FALSE ); gtk_widget_show( viewport ); table4 = gtk_grid_new(); //only need this for layout + gtk_grid_set_row_homogeneous( GTK_GRID( table4 ), TRUE ); + gtk_grid_set_column_spacing( GTK_GRID( table4 ), 2 ); gtk_container_add( GTK_CONTAINER( viewport ), table4 ); gtk_container_set_border_width( GTK_CONTAINER( table4 ), 5 ); - gtk_grid_set_column_spacing( GTK_GRID( table4 ), 2 ); + gtk_widget_set_hexpand( table4, TRUE ); gtk_widget_show( table4 ); label = gtk_label_new( "" ); //only need this for layout @@ -860,58 +863,89 @@ GtkWidget* create_SurfaceInspector( void ){ axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) ); gtk_grid_attach( GTK_GRID( table4 ), axial_button, 0, 1, 1, 1 ); + gtk_widget_set_hexpand( axial_button, TRUE ); gtk_widget_show( axial_button ); viewport = gtk_frame_new( NULL ); gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_ETCHED_OUT ); - gtk_box_pack_start( GTK_BOX( hbox2 ), viewport, FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( hbox2 ), viewport, FALSE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 ); - gtk_widget_set_hexpand( viewport, FALSE ); + gtk_widget_set_hexpand( viewport, TRUE ); gtk_widget_set_vexpand( viewport, FALSE ); gtk_widget_show( viewport ); - table5 = gtk_grid_new(); - gtk_container_add( GTK_CONTAINER( viewport ), table5 ); - gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); - gtk_grid_set_column_spacing( GTK_GRID( table5 ), 2 ); - gtk_widget_show( table5 ); + hbox3 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); + gtk_container_add( GTK_CONTAINER( viewport ), hbox3 ); + gtk_widget_set_hexpand( hbox3, TRUE ); + gtk_widget_set_vexpand( hbox3, FALSE ); + gtk_widget_show( hbox3 ); - label = gtk_label_new( _( "Height" ) ); - gtk_grid_attach( GTK_GRID( table5 ), label, 1, 0, 1, 1 ); - gtk_widget_set_halign( label, GTK_ALIGN_START ); - gtk_widget_show( label ); + table3 = gtk_grid_new(); //only need this for layout + gtk_grid_set_row_homogeneous( GTK_GRID( table3 ), TRUE ); + gtk_grid_set_column_spacing( GTK_GRID( table3 ), 2 ); + gtk_container_add( GTK_CONTAINER( hbox3 ), table3 ); + gtk_container_set_border_width( GTK_CONTAINER( table3 ), 5 ); + gtk_widget_set_hexpand( table3, TRUE ); + gtk_widget_show( table3 ); - label = gtk_label_new( _( "Width" ) ); - gtk_grid_attach( GTK_GRID( table5 ), label, 2, 0, 1, 1 ); + label = gtk_label_new( "" ); //only need this for layout + gtk_grid_attach( GTK_GRID( table3 ), label, 0, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) ); - gtk_grid_attach( GTK_GRID( table5 ), fit_button, 0, 1, 1, 1 ); + gtk_grid_attach( GTK_GRID( table3 ), fit_button, 0, 1, 2, 1 ); + gtk_widget_set_hexpand( fit_button, TRUE ); gtk_widget_show( fit_button ); + table5 = gtk_grid_new(); + gtk_grid_set_column_spacing( GTK_GRID( table5 ), 2 ); + gtk_grid_set_row_homogeneous( GTK_GRID( table5 ), TRUE ); + gtk_box_pack_start( GTK_BOX( hbox3 ), table5, FALSE, TRUE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); + gtk_widget_set_hexpand( table5, TRUE ); + gtk_widget_show( table5 ); + + label = gtk_label_new( _( "Height" ) ); + gtk_grid_attach( GTK_GRID( table5 ), label, 1, 0, 1, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); + + label = gtk_label_new( _( "Width" ) ); + gtk_grid_attach( GTK_GRID( table5 ), label, 0, 0, 1, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); + fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 ); - gtk_grid_attach( GTK_GRID( table5 ), fit_width_spinbutton, 1, 1, 1, 1 ); + gtk_grid_attach( GTK_GRID( table5 ), fit_width_spinbutton, 0, 1, 1, 1 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_set_hexpand( fit_width_spinbutton, TRUE ); gtk_widget_show( fit_width_spinbutton ); g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL ); fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 ); - gtk_grid_attach( GTK_GRID( table5 ), fit_height_spinbutton, 2, 1, 1, 1 ); + gtk_grid_attach( GTK_GRID( table5 ), fit_height_spinbutton, 1, 1, 1, 1 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_widget_set_hexpand( fit_height_spinbutton, TRUE ); gtk_widget_show( fit_height_spinbutton ); g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL ); - button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); - gtk_size_group_add_widget( button_group, axial_button ); - gtk_size_group_add_widget( button_group, fit_button ); - g_object_unref( button_group ); + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, axial_button ); + gtk_size_group_add_widget( size_group, fit_button ); + g_object_unref( size_group ); + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, table3 ); + gtk_size_group_add_widget( size_group, table4 ); + g_object_unref( size_group ); + + // closing the window (upper right window manager click) g_signal_connect( (gpointer) SurfaceInspector, diff --git a/plugins/surface_idtech2/surfacedialog.cpp b/plugins/surface_idtech2/surfacedialog.cpp index d88ec67f..0207188f 100644 --- a/plugins/surface_idtech2/surfacedialog.cpp +++ b/plugins/surface_idtech2/surfacedialog.cpp @@ -588,59 +588,46 @@ GtkWidget* create_SurfaceInspector( void ){ gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 ); gtk_widget_show( frame1 ); - table1 = gtk_table_new( 7, 3, FALSE ); - gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 ); - gtk_table_set_row_spacings( GTK_TABLE( table1 ), 5 ); + table1 = gtk_grid_new(); + gtk_grid_set_row_spacing( GTK_GRID( table1 ), 5 ); + gtk_grid_set_column_spacing( GTK_GRID( table1 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); gtk_container_add( GTK_CONTAINER( frame1 ), table1 ); + gtk_widget_set_hexpand( GTK_WIDGET( table1 ), TRUE ); gtk_widget_show( table1 ); - label = gtk_label_new( "Step" ); - gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + label = gtk_label_new( "Value" ); + gtk_grid_attach( GTK_GRID( table1 ), label, 1, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); - label = gtk_label_new( "Value" ); - gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + label = gtk_label_new( "Step" ); + gtk_grid_attach( GTK_GRID( table1 ), label, 2, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( "Horizontal shift: " ); - gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), label, 0, 1, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( "Vertical shift: " ); - gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), label, 0, 2, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( "Horizontal scale: " ); - gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), label, 0, 3, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( "Vertical scale: " ); - gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), label, 0, 4, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( "Rotate: " ); - gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), label, 0, 5, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); @@ -649,9 +636,8 @@ GtkWidget* create_SurfaceInspector( void ){ hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), hshift_value_spinbutton, 1, 1, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( hshift_value_spinbutton ), TRUE ); gtk_widget_show( hshift_value_spinbutton ); g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL ); @@ -660,9 +646,8 @@ GtkWidget* create_SurfaceInspector( void ){ vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), vshift_value_spinbutton, 1, 2, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( vshift_value_spinbutton ), TRUE ); gtk_widget_show( vshift_value_spinbutton ); g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL ); @@ -670,18 +655,16 @@ GtkWidget* create_SurfaceInspector( void ){ hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), hscale_value_spinbutton, 1, 3, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( hscale_value_spinbutton ), TRUE ); gtk_widget_show( hscale_value_spinbutton ); g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), vscale_value_spinbutton, 1, 4, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( vscale_value_spinbutton ), TRUE ); gtk_widget_show( vscale_value_spinbutton ); g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL ); @@ -689,9 +672,8 @@ GtkWidget* create_SurfaceInspector( void ){ rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 5, 6, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), rotate_value_spinbutton, 1, 5, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( rotate_value_spinbutton ), TRUE ); gtk_widget_show( rotate_value_spinbutton ); g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL ); @@ -699,117 +681,101 @@ GtkWidget* create_SurfaceInspector( void ){ adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), hshift_step_spinbutton, 2, 1, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( hshift_step_spinbutton ), TRUE ); gtk_widget_show( hshift_step_spinbutton ); g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), vshift_step_spinbutton, 2, 2, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( vshift_step_spinbutton ), TRUE ); gtk_widget_show( vshift_step_spinbutton ); g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), hscale_step_spinbutton, 2, 3, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( hscale_step_spinbutton ), TRUE ); gtk_widget_show( hscale_step_spinbutton ); g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), vscale_step_spinbutton, 2, 4, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( vscale_step_spinbutton ), TRUE ); gtk_widget_show( vscale_step_spinbutton ); g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL ); adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 2, 3, 5, 6, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), rotate_step_spinbutton, 2, 5, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( rotate_step_spinbutton ), TRUE ); gtk_widget_show( rotate_step_spinbutton ); g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" ); - gtk_table_attach( GTK_TABLE( table1 ), match_grid_button, 2, 3, 6, 7, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table1 ), match_grid_button, 2, 6, 1, 1 ); gtk_widget_show( match_grid_button ); frame2 = gtk_frame_new( "Tools" ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 ); gtk_widget_show( frame2 ); - table2 = gtk_table_new( 2, 4, TRUE ); - gtk_table_set_col_spacings( GTK_TABLE( table2), 5 ); - gtk_table_set_row_spacings( GTK_TABLE( table2 ), 0 ); - gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); + table2 = gtk_grid_new(); + gtk_grid_set_row_spacing( GTK_GRID( table2 ), 5 ); + gtk_grid_set_column_spacing( GTK_GRID( table2 ), 5 ); gtk_container_add( GTK_CONTAINER( frame2 ), table2 ); + gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); + gtk_widget_set_hexpand( GTK_WIDGET( table2 ), TRUE ); gtk_widget_show( table2 ); - label = gtk_label_new( "Height" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table2 ), label, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + label = gtk_label_new( "Brush" ); + gtk_grid_attach( GTK_GRID( table2 ), label, 0, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_set_hexpand( GTK_WIDGET( label ), TRUE ); + gtk_widget_show( label ); + + label = gtk_label_new( "Height" ); + gtk_grid_attach( GTK_GRID( table2 ), label, 2, 0, 1, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_set_hexpand( GTK_WIDGET( label ), TRUE ); gtk_widget_show( label ); label = gtk_label_new( "Width" ); - gtk_table_attach( GTK_TABLE( table2 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table2 ), label, 3, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_set_hexpand( GTK_WIDGET( label ), TRUE ); gtk_widget_show( label ); - label = gtk_label_new( "Brush" ); - gtk_table_attach( GTK_TABLE( table2 ), label, 0, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_halign( label, GTK_ALIGN_START ); - gtk_widget_show( label ); - - adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); - fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table2 ), fit_height_spinbutton, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_show( fit_height_spinbutton ); - g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL ); - adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_table_attach( GTK_TABLE( table2 ), fit_width_spinbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table2 ), fit_width_spinbutton, 2, 1, 1, 1 ); gtk_widget_show( fit_width_spinbutton ); g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL ); + adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); + fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_grid_attach( GTK_GRID( table2 ), fit_height_spinbutton, 3, 1, 1, 1 ); + gtk_widget_show( fit_height_spinbutton ); + g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL ); + fit_button = gtk_button_new_with_mnemonic( "Fit" ); - gtk_table_attach( GTK_TABLE( table2 ), fit_button, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table2 ), fit_button, 0, 1, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( fit_button ), TRUE ); gtk_widget_show( fit_button ); axial_button = gtk_button_new_with_mnemonic( "Axial" ); - gtk_table_attach( GTK_TABLE( table2 ), axial_button, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table2 ), axial_button, 1, 1, 1, 1 ); + gtk_widget_set_hexpand( GTK_WIDGET( axial_button ), TRUE ); gtk_widget_show( axial_button ); size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); diff --git a/plugins/surface_idtech2/surfaceflags.cpp b/plugins/surface_idtech2/surfaceflags.cpp index b388a2ef..5c67a929 100644 --- a/plugins/surface_idtech2/surfaceflags.cpp +++ b/plugins/surface_idtech2/surfaceflags.cpp @@ -321,10 +321,12 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 ); gtk_widget_show( vbox2 ); - table4 = gtk_table_new( 8, 4, TRUE ); - gtk_table_set_col_spacings( GTK_TABLE( table4 ), 5 ); - gtk_table_set_row_spacings( GTK_TABLE( table4 ), 5 ); + table4 = gtk_grid_new(); + gtk_grid_set_column_spacing( GTK_GRID( table4 ), 5 ); + gtk_grid_set_row_spacing( GTK_GRID( table4 ), 5 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table4, TRUE, TRUE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( table4 ), 5 ); + gtk_widget_set_hexpand( table4, TRUE ); gtk_widget_show( table4 ); y = -1; @@ -338,14 +340,14 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ //Sys_Printf( "%s: %s\n", buffer, buttonLabel ); surface_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); g_signal_connect( surface_buttons[i], "toggled", G_CALLBACK( on_surface_button_toggled ), GINT_TO_POINTER( 1 << i ) ); + gtk_grid_attach( GTK_GRID( table4 ), surface_buttons[i], x, y, 1, 1 ); + gtk_widget_set_hexpand( surface_buttons[i], TRUE ); gtk_widget_show( surface_buttons[i] ); - gtk_table_attach( GTK_TABLE( table4 ), surface_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); } hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 4 ); gtk_widget_show( hbox2 ); hbox3 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); @@ -353,10 +355,10 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ gtk_widget_show( hbox3 ); vbox4 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); - gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 ); gtk_widget_show( vbox4 ); - value_label = gtk_label_new( "Value: " ); + value_label = gtk_label_new( "Value:" ); gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 ); gtk_widget_set_halign( value_label, GTK_ALIGN_START ); gtk_widget_show( value_label ); @@ -381,10 +383,12 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label5 ); gtk_widget_show( label5 ); - table3 = gtk_table_new( 8, 4, TRUE ); - gtk_table_set_col_spacings( GTK_TABLE( table3 ), 5 ); - gtk_table_set_row_spacings( GTK_TABLE( table3 ), 5 ); + table3 = gtk_grid_new(); + gtk_grid_set_column_spacing( GTK_GRID( table3 ), 5 ); + gtk_grid_set_row_spacing( GTK_GRID( table3 ), 5 ); gtk_container_add( GTK_CONTAINER( notebook1 ), table3 ); + gtk_container_set_border_width( GTK_CONTAINER( table3 ), 5 ); + gtk_widget_set_hexpand( table3, TRUE ); gtk_widget_show( table3 ); y = -1; @@ -397,9 +401,8 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer ); content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); g_signal_connect( content_buttons[i], "toggled", G_CALLBACK( on_content_button_toggled ), GINT_TO_POINTER( 1 << i ) ); - gtk_table_attach( GTK_TABLE( table3 ), content_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table3 ), content_buttons[i], x, y, 1, 1 ); + gtk_widget_set_hexpand( content_buttons[i], TRUE ); gtk_widget_show( content_buttons[i] ); } diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 2372faf7..3ec16bc9 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -537,169 +537,128 @@ void SurfaceDlg::BuildDialog() { g_signal_connect( entry, "key_press_event", G_CALLBACK( OnTextureKey ), NULL ); g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry ); -// table = gtk_table_new (5, 4, FALSE); - table = gtk_table_new( 6, 4, FALSE ); - gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + table = gtk_grid_new(); + gtk_grid_set_row_spacing( GTK_GRID( table ), 5 ); + gtk_grid_set_column_spacing( GTK_GRID( table ), 5 ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_widget_show( table ); label = gtk_label_new( _( "Horizontal shift" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), spin, 1, 0, 1, 1 ); gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "hshift", spin ); g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 2, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), entry, 3, 0, 1, 1 ); gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry ); g_signal_connect( entry, "changed", G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Vertical shift" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 1, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), spin, 1, 1, 1, 1 ); gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "vshift", spin ); g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 2, 1, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), entry, 3, 1, 1, 1 ); gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry ); g_signal_connect( entry, "changed", G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Horizontal stretch" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 2, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), spin, 1, 2, 1, 1 ); gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "hscale", spin ); g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 2, 3 ); + gtk_grid_attach( GTK_GRID( table ), label, 2, 2, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 2, 3 ); + gtk_grid_attach( GTK_GRID( table ), entry, 3, 2, 1, 1 ); gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry ); g_signal_connect( entry, "changed", G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Vertical stretch" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 3, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), spin, 1, 3, 1, 1 ); gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "vscale", spin ); g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 2, 3, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), entry, 3, 3, 1, 1 ); gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry ); g_signal_connect( entry, "changed", G_CALLBACK( OnIncrementChanged ), NULL ); label = gtk_label_new( _( "Rotate" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 4, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 0 ) ), 1, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); - gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), spin, 1, 4, 1, 1 ); gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "rotate", spin ); g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", G_CALLBACK( OnUpdate ), NULL ); label = gtk_label_new( _( "Step" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 2, 4, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), entry, 3, 4, 1, 1 ); gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry ); g_signal_connect( entry, "changed", @@ -707,9 +666,7 @@ void SurfaceDlg::BuildDialog() { // match grid button button = gtk_button_new_with_label( _( "Match Grid" ) ); - gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), button, 3, 5, 1, 1 ); gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnMatchGrid ), NULL ); @@ -718,53 +675,41 @@ void SurfaceDlg::BuildDialog() { gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_widget_show( frame ); - table = gtk_table_new( 4, 4, FALSE ); - gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + table = gtk_grid_new(); + gtk_grid_set_row_spacing( GTK_GRID( table ), 5 ); + gtk_grid_set_column_spacing( GTK_GRID( table ), 5 ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_widget_show( table ); label = gtk_label_new( "Brush" ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( "Patch" ); - gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 2, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( "Width" ); - gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 2, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); label = gtk_label_new( _( "Height" ) ); - gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), label, 3, 0, 1, 1 ); gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); axial_button = button = gtk_button_new_with_label( _( "Axial" ) ); - gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), button, 0, 1, 1, 1 ); gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnAxial ), NULL ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), button, 1, 1, 1, 1 ); gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnFaceFit ), NULL ); @@ -775,33 +720,25 @@ void SurfaceDlg::BuildDialog() { g_object_unref( button_group ); cap_button = button = gtk_button_new_with_label( _( "CAP" ) ); - gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), button, 0, 3, 1, 1 ); gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchdetails ), NULL ); set_button = button = gtk_button_new_with_label( _( "Set..." ) ); - gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), button, 1, 3, 1, 1 ); gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchreset ), NULL ); nat_button = button = gtk_button_new_with_label( _( "Natural" ) ); - gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), button, 2, 3, 1, 1 ); gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchnatural ), NULL ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), button, 3, 3, 1, 1 ); gtk_widget_show( button ); g_signal_connect( button, "clicked", G_CALLBACK( OnBtnPatchFit ), NULL ); @@ -814,16 +751,12 @@ void SurfaceDlg::BuildDialog() { g_object_unref( button_group ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); - gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), spin, 2, 1, 1, 1 ); gtk_widget_show( spin ); AddDialogData( spin, &m_nWidth, DLG_SPIN_INT ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); - gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_grid_attach( GTK_GRID( table ), spin, 3, 1, 1, 1 ); gtk_widget_show( spin ); AddDialogData( spin, &m_nHeight, DLG_SPIN_INT ); From 0c7dd38f8560d14a07630f7aad926a01d3d1c795 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 6 Oct 2015 15:22:28 +0200 Subject: [PATCH 19/27] 4way layout center --- radiant/gtkmisc.cpp | 2 +- radiant/mainframe.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index eecc2c1b..bf65888d 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -910,7 +910,7 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message, // add message GtkWidget *dlg_msg = gtk_label_new( message ); gtk_box_pack_start( GTK_BOX( icon_text_hbox ), dlg_msg, FALSE, FALSE, MSGBOX_PAD_MINOR ); - gtk_label_set_justify( GTK_LABEL( dlg_msg ), GTK_JUSTIFY_LEFT ); + gtk_widget_set_halign( dlg_msg, GTK_ALIGN_START ); gtk_widget_show( dlg_msg ); // add buttons diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 94dd724c..e6567482 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2779,7 +2779,7 @@ void MainFrame::Create(){ else if ( CurrentStyle() == eFloating ) { { GtkWidget* wnd = create_floating( this ); - gtk_window_set_title( GTK_WINDOW( wnd ), "Camera" ); + gtk_window_set_title( GTK_WINDOW( wnd ), _( "Camera" ) ); #ifdef _WIN32 if ( g_PrefsDlg.m_bStartOnPrimMon ) { @@ -2805,7 +2805,7 @@ void MainFrame::Create(){ { GtkWidget* wnd = create_floating( this ); - gtk_window_set_title( GTK_WINDOW( wnd ), "XY View" ); + gtk_window_set_title( GTK_WINDOW( wnd ), _( "XY View" ) ); #ifdef _WIN32 if ( g_PrefsDlg.m_bStartOnPrimMon ) { @@ -2830,7 +2830,7 @@ void MainFrame::Create(){ else { GtkWidget* wnd = create_floating( this ); - gtk_window_set_title( GTK_WINDOW( wnd ), "XY View" ); + gtk_window_set_title( GTK_WINDOW( wnd ), _( "XY View" ) ); #ifdef _WIN32 if ( g_PrefsDlg.m_bStartOnPrimMon ) { @@ -3001,18 +3001,21 @@ void MainFrame::Create(){ { gint max_position; - g_object_get( m_pSplits[0], "max-position", &max_position, NULL ); + //g_object_get( m_pSplits[0], "max-position", &max_position, NULL ); + max_position = gtk_widget_get_allocated_width( m_pSplits[0] ); int x = max_position / 2 - gutter; gtk_paned_set_position( GTK_PANED( m_pSplits[0] ), x ); } { gint max_position; - g_object_get( m_pSplits[0], "max-position", &max_position, NULL ); + //g_object_get( m_pSplits[0], "max-position", &max_position, NULL ); + max_position = gtk_widget_get_allocated_height( m_pSplits[0] ); int y = max_position / 2 - gutter; gtk_paned_set_position( GTK_PANED( m_pSplits[1] ), y ); gtk_paned_set_position( GTK_PANED( m_pSplits[2] ), y ); } + } if ( g_PrefsDlg.mWindowInfo.nState & GDK_WINDOW_STATE_MAXIMIZED ) { From 242a5aa9626c5bac60104948f22701ed95967d97 Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Tue, 6 Oct 2015 18:22:26 +0200 Subject: [PATCH 20/27] Forgot XZ and YZ views, sorry again --- radiant/xywindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 70c4e885..0a2b98f2 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2645,7 +2645,7 @@ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxB qglEnd(); - qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), 0, vMinBounds[nDim2] - 20.0 / m_fScale ); + qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), 0, vMinBounds[nDim2] - 25.0 / m_fScale ); g_strDim.Format( g_pDimStrings[nDim1], vSize[nDim1] ); gtk_glwidget_print_string( (char *) g_strDim.GetBuffer() ); @@ -2682,7 +2682,7 @@ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxB qglEnd(); - qglRasterPos3f( 0, Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 20.0 / m_fScale ); + qglRasterPos3f( 0, Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 25.0 / m_fScale ); g_strDim.Format( g_pDimStrings[nDim1], vSize[nDim1] ); gtk_glwidget_print_string( (char *) g_strDim.GetBuffer() ); From cb7276babf16fb23f71511a82c233039a4f7e0b7 Mon Sep 17 00:00:00 2001 From: Ensiform Date: Fri, 9 Oct 2015 10:59:01 -0500 Subject: [PATCH 21/27] Adds misc_model_breakable entity rendering support for Jedi Academy. --- radiant/xywindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index e78305b5..6a05447d 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -360,6 +360,7 @@ static const char *model_classnames[] = { "misc_model", "misc_model_static", + "misc_model_breakable", "misc_gamemodel", "model_static", }; From 0585822882a3409f2d5a756852699bfb2d0b350a Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sun, 11 Oct 2015 13:40:20 +0200 Subject: [PATCH 22/27] Texture directory list for the other layouts --- radiant/mainframe.cpp | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 3cc8f955..dbccaf5a 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2924,9 +2924,26 @@ void MainFrame::Create(){ GtkWidget* frame = create_framed_texwnd( m_pTexWnd ); m_pTexWnd->m_pParent = g_pGroupDlg->m_pWidget; + GtkWidget* w = gtk_label_new( _( "Textures" ) ); + gtk_widget_show( w ); + + if( g_PrefsDlg.m_bShowTexDirList ) + { + gint pos = 0; + GtkWidget* texDirList = create_texdirlist_widget( &pos ); + + GtkWidget* texSplit = gtk_paned_new( GTK_ORIENTATION_HORIZONTAL ); + + gtk_paned_add1( GTK_PANED( texSplit ), texDirList ); + gtk_paned_add2( GTK_PANED( texSplit ), frame ); + + gtk_paned_set_position( GTK_PANED( texSplit ), pos ); + + gtk_widget_show( texSplit ); + + gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), texSplit, w, 1 ); + } else { - GtkWidget* w = gtk_label_new( _( "Textures" ) ); - gtk_widget_show( w ); gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), frame, w, 1 ); } } @@ -2987,9 +3004,26 @@ void MainFrame::Create(){ m_pTexWnd = new TexWnd(); GtkWidget* frame = create_framed_texwnd( m_pTexWnd ); + GtkWidget* w = gtk_label_new( _( "Textures" ) ); + gtk_widget_show( w ); + + if( g_PrefsDlg.m_bShowTexDirList ) + { + gint pos = 0; + GtkWidget* texDirList = create_texdirlist_widget( &pos ); + + GtkWidget* texSplit = gtk_paned_new( GTK_ORIENTATION_HORIZONTAL ); + + gtk_paned_add1( GTK_PANED( texSplit ), texDirList ); + gtk_paned_add2( GTK_PANED( texSplit ), frame ); + + gtk_paned_set_position( GTK_PANED( texSplit ), pos ); + + gtk_widget_show( texSplit ); + + gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), texSplit, w, 1 ); + } else { - GtkWidget* w = gtk_label_new( _( "Textures" ) ); - gtk_widget_show( w ); gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), frame, w, 1 ); } } From 51c301b8f76fa47c66b08a9f3e0f934d151ae40e Mon Sep 17 00:00:00 2001 From: Pan7 Date: Mon, 12 Oct 2015 16:51:38 +0200 Subject: [PATCH 23/27] Fixed Texture Size for the Texture Browser --- radiant/texwindow.cpp | 53 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 58ff312f..9dfdfc34 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1224,6 +1224,44 @@ void Texture_ShowStartupShaders(){ ============================================================================ */ +void Texture_GetSize( qtexture_t *tex, int & nWidth, int & nHeight ){ + if( !tex ) + return; + + if( g_PrefsDlg.m_bFixedTextureSize && g_PrefsDlg.m_nFixedTextureSizeWidth > 0 && g_PrefsDlg.m_nFixedTextureSizeHeight > 0 ) + { + nWidth = g_PrefsDlg.m_nFixedTextureSizeWidth; + nHeight = g_PrefsDlg.m_nFixedTextureSizeHeight; + float ratioWidth = nHeight / nWidth; + float ratioHeight = nWidth / nHeight; + if( tex->width * ratioWidth > tex->height * ratioHeight ) + { + nHeight *= tex->height * 1.0f / tex->width * ratioWidth; + } else + if( tex->height * ratioHeight > tex->width * ratioWidth ) + { + nWidth *= tex->width * 1.0f / tex->height * ratioHeight; + } + } else { + nWidth = (int)( tex->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + nHeight = (int)( tex->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + } +} + +void Texture_GetPosSize( qtexture_t *tex, int & nWidth, int & nHeight ){ + if( !tex ) + return; + + if( g_PrefsDlg.m_bFixedTextureSize && g_PrefsDlg.m_nFixedTextureSizeWidth > 0 && g_PrefsDlg.m_nFixedTextureSizeHeight > 0 ) + { + nWidth = g_PrefsDlg.m_nFixedTextureSizeWidth; + nHeight = g_PrefsDlg.m_nFixedTextureSizeHeight; + } else { + nWidth = (int)( tex->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + nHeight = (int)( tex->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + } +} + void Texture_StartPos( void ){ //++timo TODO: check use of current_texture and current_row? current_x = 8; @@ -1290,8 +1328,9 @@ IShader* Texture_NextPos( int *x, int *y ){ continue; } - int nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); - int nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + int nWidth; + int nHeight; + Texture_GetPosSize( q, nWidth, nHeight ); if ( current_x + nWidth > g_qeglobals.d_texturewin.width - 8 && current_row ) { // go to the next row unless the texture is the first on the row current_x = 8; current_y -= current_row + FONT_HEIGHT + 4; @@ -1613,14 +1652,8 @@ void Texture_Draw( int width, int height ){ break; } - if( g_PrefsDlg.m_bFixedTextureSize && g_PrefsDlg.m_nFixedTextureSizeWidth > 0 && g_PrefsDlg.m_nFixedTextureSizeHeight > 0 ) - { - nWidth = g_PrefsDlg.m_nFixedTextureSizeWidth; - nHeight = g_PrefsDlg.m_nFixedTextureSizeHeight; - } else { - nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); - nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); - } + Texture_GetSize( q, nWidth, nHeight ); + if ( y != last_y ) { last_y = y; last_height = 0; From e8acfaebc1d75431606daaee9c5bd566f7015186 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Fri, 16 Oct 2015 14:59:40 +0200 Subject: [PATCH 24/27] Find / replace history --- radiant/gtkdlgs.cpp | 120 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 6 deletions(-) diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index dd13e824..455bfaeb 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -3487,6 +3487,41 @@ int DoLightIntensityDlg( int *intensity ){ return ret; } +static void limitHistory( GtkWidget *combo, gint max_count ) +{ + GtkTreeModel *model; + gint length; + + if( max_count <= 0 ) + return; + + model = gtk_combo_box_get_model( GTK_COMBO_BOX( combo ) ); + if( !model ) + return; + + length = gtk_tree_model_iter_n_children( model, NULL ); + if( length > max_count ) + { + int i; + gint count = length - max_count; + + for( i = 0; i < count; i++ ) + { + gtk_combo_box_text_remove( GTK_COMBO_BOX_TEXT( combo ), 0 ); + } + } +} +static void AddToFindHistory( GtkWidget *combo, const gchar *strFind ) +{ + gtk_combo_box_text_append( GTK_COMBO_BOX_TEXT( combo ), strFind, strFind ); + limitHistory( combo, 20 ); +} +static void AddToReplaceHistory( GtkWidget *combo, const gchar *strReplace ) +{ + gtk_combo_box_text_append( GTK_COMBO_BOX_TEXT( combo ), strReplace, strReplace ); + limitHistory( combo, 20 ); +} + static void OnReplace_clicked( GtkButton *button, gpointer data ) { gboolean bSelectedOnly, bForce; @@ -3511,6 +3546,9 @@ static void OnReplace_clicked( GtkButton *button, gpointer data ) strReplace = gtk_entry_get_text( GTK_ENTRY( entry ) ); FindReplaceTextures( strFind, strReplace, bSelectedOnly, bForce, FALSE ); + + AddToFindHistory( find_combo, strFind ); + AddToReplaceHistory( replace_combo, strReplace ); } static void OnFind_clicked( GtkButton *button, gpointer data ) { @@ -3533,13 +3571,72 @@ static void OnFind_clicked( GtkButton *button, gpointer data ) strReplace = gtk_entry_get_text( GTK_ENTRY( entry ) ); FindReplaceTextures( strFind, strReplace, bSelectedOnly, FALSE, TRUE ); + + AddToFindHistory( find_combo, strFind ); +} + +static void findpopup_selected( GtkWidget *widget, gpointer data ) +{ + const gchar *str; + GtkWidget *label; + + GtkWidget *texlabel = GTK_WIDGET( g_object_get_data( G_OBJECT( widget ), "texture-label" ) ); + if( texlabel ) + { + label = texlabel; + } else + { + label = gtk_bin_get_child( GTK_BIN( widget ) ); + } + str = gtk_label_get_text( GTK_LABEL( label ) ); + gtk_entry_set_text( GTK_ENTRY( data ), str ); +} + +static void findbutton_clicked( GtkWidget *widget, gpointer data ) +{ + GtkWidget *menu, *item; + menu = gtk_menu_new(); + + for ( int i = 0; i < QERApp_GetActiveShaderCount(); i++ ) + { + IShader *pShader = QERApp_ActiveShader_ForIndex( i ); + + if( strcmp( g_qeglobals.d_texturewin.texdef.GetName(), pShader->getName() ) == 0 ) + { + GtkWidget *label, *box; + + item = gtk_menu_item_new(); + + box = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 6 ); + gtk_container_add( GTK_CONTAINER( item ), box ); + gtk_widget_show( box ); + + label = gtk_label_new( pShader->getName() ); + gtk_container_add( GTK_CONTAINER( box ), label ); + gtk_widget_show( label ); + g_object_set_data( G_OBJECT( item ), "texture-label", label ); + + label = gtk_label_new( _( "!" ) ); + gtk_container_add( GTK_CONTAINER( box ), label ); + gtk_widget_show( label ); + + } else + { + item = gtk_menu_item_new_with_label( pShader->getName() ); + } + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); + gtk_widget_show( item ); + g_signal_connect( item, "activate", G_CALLBACK( findpopup_selected ), data ); + } + + gtk_menu_popup( GTK_MENU( menu ), NULL, widget, NULL, NULL, 1, GDK_CURRENT_TIME ); } void DoFindReplaceTexturesDialog() { GtkWidget *dialog, *content_area, *combo, *hbox; GtkWidget *vbox, *table, *label, *button, *find_button, *replace_button; - GtkWidget *find_combo, *replace_combo, *check; + GtkWidget *find_combo, *replace_combo, *check, *entry; GtkSizeGroup *button_group; GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; @@ -3570,23 +3667,34 @@ void DoFindReplaceTexturesDialog() gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_show( label ); - label = gtk_label_new( "Replace:" ); - gtk_grid_attach( GTK_GRID( table ), label, 0, 1, 1, 1 ); - gtk_widget_set_halign( label, GTK_ALIGN_START ); - gtk_widget_show( label ); - find_combo = combo = gtk_combo_box_text_new_with_entry(); gtk_grid_attach( GTK_GRID( table ), combo, 1, 0, 1, 1 ); gtk_widget_set_hexpand( combo, TRUE ); gtk_widget_show( combo ); g_object_set_data( G_OBJECT( dialog ), "find_combo", find_combo ); + button = gtk_button_new_with_label( "..." ); + gtk_grid_attach( GTK_GRID( table ), button, 2, 0, 1, 1 ); + gtk_widget_show( button ); + entry = gtk_bin_get_child( GTK_BIN( find_combo ) ); + g_signal_connect( button, "clicked", G_CALLBACK( findbutton_clicked ), entry ); + + label = gtk_label_new( "Replace:" ); + gtk_grid_attach( GTK_GRID( table ), label, 0, 1, 1, 1 ); + gtk_widget_set_halign( label, GTK_ALIGN_START ); + gtk_widget_show( label ); + replace_combo = combo = gtk_combo_box_text_new_with_entry(); gtk_grid_attach( GTK_GRID( table ), combo, 1, 1, 1, 1 ); gtk_widget_set_hexpand( combo, TRUE ); gtk_widget_show( combo ); g_object_set_data( G_OBJECT( dialog ), "replace_combo", replace_combo ); + button = gtk_button_new_with_label( "..." ); + gtk_grid_attach( GTK_GRID( table ), button, 2, 1, 1, 1 ); + gtk_widget_show( button ); + entry = gtk_bin_get_child( GTK_BIN( replace_combo ) ); + g_signal_connect( button, "clicked", G_CALLBACK( findbutton_clicked ), entry ); check = gtk_check_button_new_with_label( "Use selected brushes only" ); gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 ); From 4f516b1f60fa030c092e7826f5e524163e1406db Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 17 Oct 2015 02:24:22 +0200 Subject: [PATCH 25/27] Fixed Texture Size, selecting size --- radiant/texwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 9dfdfc34..03e63d87 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1481,8 +1481,9 @@ void SelectTexture( int mx, int my, bool bShift, bool bFitScale ){ if ( !q ) { break; } - int nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); - int nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); + int nWidth; + int nHeight; + Texture_GetPosSize( q, nWidth, nHeight ); if ( mx > x && mx - x < nWidth && my < y && y - my < nHeight + FONT_HEIGHT ) { if ( bShift ) { From b4ea54da9cbf95a6704f9ba1ceb77dab687447a8 Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Sat, 31 Oct 2015 12:47:35 +0100 Subject: [PATCH 26/27] XYZ position adjusted With either show_axis true or false. --- radiant/xywindow.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 6a05447d..92da1b76 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2302,9 +2302,9 @@ void XYWnd::XY_DrawGrid(){ qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME] ); } - // we do this part (the old way) only if show_axis is disabled + // We do this part (the old way) only if show_axis is disabled if ( !g_qeglobals.d_savedinfo.show_axis ) { - qglRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale ); + qglRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale ); char cView[20]; if ( m_nViewType == XY ) { @@ -2314,7 +2314,7 @@ void XYWnd::XY_DrawGrid(){ if ( m_nViewType == XZ ) { strcpy( cView, "XZ Front" ); } - else{ + else { strcpy( cView, "YZ Side" ); } @@ -2323,9 +2323,10 @@ void XYWnd::XY_DrawGrid(){ } if ( g_qeglobals.d_savedinfo.show_axis ) { - // draw two lines with corresponding axis colors to highlight current view - // horizontal line: nDim1 color + // Draw two lines with corresponding axis colors to highlight current view + // Horizontal line: nDim1 color qglLineWidth( 2 ); + qglBegin( GL_LINES ); qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim1] ); qglVertex2f( m_vOrigin[nDim1] - w + 40 / m_fScale, m_vOrigin[nDim2] + h - 45 / m_fScale ); @@ -2338,15 +2339,18 @@ void XYWnd::XY_DrawGrid(){ qglVertex2f( 0, 0 ); qglVertex2f( 0, 32 / m_fScale ); qglEnd(); + qglLineWidth( 1 ); - // now print axis symbols + + // Now print axis symbols qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim1] ); - qglRasterPos2f( m_vOrigin[nDim1] - w + 55 / m_fScale, m_vOrigin[nDim2] + h - 55 / m_fScale ); + qglRasterPos2f( m_vOrigin[nDim1] - w + 57 / m_fScale, m_vOrigin[nDim2] + h - 60 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim1] ); qglRasterPos2f( 28 / m_fScale, -10 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim1] ); + qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim2] ); - qglRasterPos2f( m_vOrigin[nDim1] - w + 25 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale ); + qglRasterPos2f( m_vOrigin[nDim1] - w + 30 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim2] ); qglRasterPos2f( -10 / m_fScale, 28 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim2] ); @@ -2668,7 +2672,7 @@ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxB qglEnd(); - qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), 0, vMinBounds[nDim2] - 25.0 / m_fScale ); + qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), 0, vMinBounds[nDim2] - 20.0 / m_fScale ); g_strDim.Format( g_pDimStrings[nDim1], vSize[nDim1] ); gtk_glwidget_print_string( (char *) g_strDim.GetBuffer() ); @@ -2705,7 +2709,7 @@ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxB qglEnd(); - qglRasterPos3f( 0, Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 25.0 / m_fScale ); + qglRasterPos3f( 0, Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 20.0 / m_fScale ); g_strDim.Format( g_pDimStrings[nDim1], vSize[nDim1] ); gtk_glwidget_print_string( (char *) g_strDim.GetBuffer() ); From 4cf9cfef94b41a82ec6b8c5361a8a8ce2bda8ca5 Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Sat, 31 Oct 2015 14:12:44 +0100 Subject: [PATCH 27/27] Adjusted middle XYZ position --- radiant/xywindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 92da1b76..72d1c53a 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2346,13 +2346,13 @@ void XYWnd::XY_DrawGrid(){ qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim1] ); qglRasterPos2f( m_vOrigin[nDim1] - w + 57 / m_fScale, m_vOrigin[nDim2] + h - 60 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim1] ); - qglRasterPos2f( 28 / m_fScale, -10 / m_fScale ); + qglRasterPos2f( 25 / m_fScale, -15 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim1] ); qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim2] ); qglRasterPos2f( m_vOrigin[nDim1] - w + 30 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim2] ); - qglRasterPos2f( -10 / m_fScale, 28 / m_fScale ); + qglRasterPos2f( -10 / m_fScale, 20 / m_fScale ); gtk_glwidget_print_char( g_AxisName[nDim2] ); }