Merge branch 'master' of https://github.com/TTimo/GtkRadiant into TexDirList

# Conflicts:
#	radiant/preferences.cpp
This commit is contained in:
Pan7 2017-05-22 13:51:27 +02:00
commit 1294c35880
33 changed files with 365 additions and 216 deletions

View file

@ -342,7 +342,8 @@ void InitBackgroundDialog(){
pPage = new CBackgroundDialogPage( YZ );
pPage->Append( pNotebook );
vbox = gtk_hbox_new( TRUE, 5 );
vbox = gtk_hbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE );
gtk_container_add( GTK_CONTAINER( content_area ), vbox );
gtk_widget_show( vbox );

View file

@ -55,7 +55,7 @@
#define CMD_SEP "-"
#define CMD_CONFIG "Configure..."
#define CMD_ABOUT "About..."
#define CMD_ABOUT "About"
// =============================================================================
// Globals

View file

@ -39,7 +39,7 @@ _QEREntityTable g_EntityTable;
const char* PLUGIN_NAME = "bobToolz";
// commands in the menu
static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Turn edge";
static const char* PLUGIN_COMMANDS = "About,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Turn edge";
// globals
GtkWidget *g_pRadiantWnd = NULL;
@ -103,7 +103,7 @@ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool
else if ( !stricmp( p, "vis viewer" ) ) {
DoVisAnalyse();
}
else if ( !stricmp( p, "about..." ) ) {
else if ( !stricmp( p, "About" ) ) {
DoMessageBox( PLUGIN_ABOUT, "About", MB_OK );
}
}

View file

@ -33,13 +33,13 @@ typedef struct {
GtkWidget *editTexOld, *editTexNew;
GtkWidget *cbScaleHor, *cbScaleVert;
GtkWidget *editScaleHor, *editScaleVert;
GtkWidget *spinScaleHor, *spinScaleVert;
GtkWidget *cbShiftHor, *cbShiftVert;
GtkWidget *editShiftHor, *editShiftVert;
GtkWidget *spinShiftHor, *spinShiftVert;
GtkWidget *cbRotation;
GtkWidget *editRotation;
GtkWidget *spinRotation;
}dlg_texReset_t;
dlg_texReset_t dlgTexReset;
@ -60,19 +60,19 @@ void Update_TextureReseter(){
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexOld ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleHor ), check );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinScaleHor ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleVert ), check );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinScaleVert ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftHor ), check );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinShiftHor ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftVert ), check );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinShiftVert ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editRotation ), check );
gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinRotation ), check );
}
static void dialog_button_callback( GtkWidget *widget, gpointer data ){
@ -1287,7 +1287,8 @@ int DoResetTextureBox( ResetTextureRS* rs ){
content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
vbox = gtk_vbox_new( TRUE, 5 );
vbox = gtk_vbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE );
gtk_container_add( GTK_CONTAINER( content_area ), vbox );
gtk_widget_show( vbox );
@ -1320,7 +1321,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE );
table = gtk_table_new( 2, 3, FALSE );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@ -1348,7 +1349,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editTexOld ), 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editTexOld );
@ -1363,7 +1364,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editTexNew ), 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editTexNew );
@ -1373,7 +1374,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE );
table = gtk_table_new( 2, 3, FALSE );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@ -1397,13 +1398,14 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
dlgTexReset.editScaleHor = gtk_entry_new();
gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editScaleHor ), 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1,
dlgTexReset.spinScaleHor = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0.5, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinScaleHor ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinScaleHor ), 1.0 ); //right align numbers
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinScaleHor, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editScaleHor );
gtk_widget_show( dlgTexReset.spinScaleHor );
dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( _( "Enabled" ) );
@ -1420,13 +1422,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
dlgTexReset.editScaleVert = gtk_entry_new();
gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editScaleVert ), 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2,
dlgTexReset.spinScaleVert = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0.5, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinScaleVert ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinScaleVert ), 1.0 ); //right align numbers
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinScaleVert, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editScaleVert );
gtk_widget_show( dlgTexReset.spinScaleVert );
// ---- /frame ----
@ -1434,7 +1436,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE );
table = gtk_table_new( 2, 3, FALSE );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@ -1458,13 +1460,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
dlgTexReset.editShiftHor = gtk_entry_new();
gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editShiftHor ), 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1,
dlgTexReset.spinShiftHor = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinShiftHor ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinShiftHor ), 1.0 ); //right align numbers
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinShiftHor, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editShiftHor );
gtk_widget_show( dlgTexReset.spinShiftHor );
dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( _( "Enabled" ) );
@ -1481,13 +1483,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
dlgTexReset.editShiftVert = gtk_entry_new();
gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editShiftVert ), 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2,
dlgTexReset.spinShiftVert = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinShiftVert ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinShiftVert ), 1.0 ); //right align numbers
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinShiftVert, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editShiftVert );
gtk_widget_show( dlgTexReset.spinShiftVert );
// ---- /frame ----
@ -1495,7 +1497,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 1, 3, TRUE );
table = gtk_table_new( 1, 3, FALSE );
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 );
@ -1517,13 +1519,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
gtk_widget_show( w );
dlgTexReset.editRotation = gtk_entry_new();
gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editRotation ), 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1,
dlgTexReset.spinRotation = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 90, 0 ) ), 1, 1 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinRotation ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinRotation ), 1.0 ); //right align numbers
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinRotation, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editRotation );
gtk_widget_show( dlgTexReset.spinRotation );
// ---- /frame ----
@ -1553,37 +1555,27 @@ int DoResetTextureBox( ResetTextureRS* rs ){
if ( response_id != GTK_RESPONSE_CANCEL ) {
rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
if ( rs->bResetRotation ) {
if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editRotation ) ), _( "Rotation" ), &rs->rotation ) ) {
dialogError = TRUE;
}
rs->rotation = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinRotation ) );
}
rs->bResetScale[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
if ( rs->bResetScale[0] ) {
if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleHor ) ), _( "Horizontal Scale" ), &rs->fScale[0] ) ) {
dialogError = TRUE;
}
rs->fScale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinScaleHor ) );
}
rs->bResetScale[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
if ( rs->bResetScale[1] ) {
if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleVert ) ), _( "Vertical Scale" ), &rs->fScale[1] ) ) {
dialogError = TRUE;
}
rs->fScale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinScaleVert ) );
}
rs->bResetShift[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
if ( rs->bResetShift[0] ) {
if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftHor ) ), _( "Horizontal Shift" ), &rs->fShift[0] ) ) {
dialogError = TRUE;
}
rs->fShift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinShiftHor ) );
}
rs->bResetShift[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
if ( rs->bResetShift[1] ) {
if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftVert ) ), _( "Vertical Shift" ), &rs->fShift[1] ) ) {
dialogError = TRUE;
}
rs->fShift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinShiftVert ) );
}
rs->bResetTextureName = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );

View file

@ -36,7 +36,7 @@ CListener *Listener = NULL;
static const char *PLUGIN_NAME = "Camera";
// commands in the menu
static const char *PLUGIN_COMMANDS = "About...,-,Load Camera...,-,Preview Camera,-,Camera Inspector...,-,New Spline Camera,New Interpolated Camera,New Fixed Camera";
static const char *PLUGIN_COMMANDS = "About,-,Load Camera...,-,Preview Camera,-,Camera Inspector...,-,New Spline Camera...,New Interpolated Camera...,New Fixed Camera...";
// globals
GtkWidget *g_pRadiantWnd = NULL;
@ -116,7 +116,7 @@ void QERPlug_Dispatch( const char* p, float* vMin, float* vMax, bool bSingleBrus
else if ( !strcmp( p, "Load Camera..." ) ) {
DoLoadCamera();
}
else if ( !strcmp( p, "About..." ) ) {
else if ( !strcmp( p, "About" ) ) {
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, PLUGIN_ABOUT, "About", MB_OK, NULL );
}
}

View file

@ -1392,7 +1392,8 @@ GtkWidget* create_main_dialog(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
gtk_widget_show( frame );
vbox = gtk_vbox_new( TRUE, 5 );
vbox = gtk_vbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
@ -1413,7 +1414,8 @@ GtkWidget* create_main_dialog(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
gtk_widget_show( frame );
vbox = gtk_vbox_new( TRUE, 5 );
vbox = gtk_vbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
@ -1434,7 +1436,8 @@ GtkWidget* create_main_dialog(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
gtk_widget_show( frame );
vbox = gtk_vbox_new( TRUE, 5 );
vbox = gtk_vbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
@ -1837,7 +1840,8 @@ GtkWidget* create_main_dialog(){
g_object_set_data( G_OBJECT( dlg ), "bmp_file", entry );
g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( bitmap_file_entryfocusout ), NULL );
hbox2 = gtk_hbox_new( TRUE, 5 );
hbox2 = gtk_hbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( hbox2 ), TRUE );
gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );

View file

@ -40,8 +40,8 @@ const char* QERPlug_GetName(){
}
const char* QERPlug_GetCommandList(){
return "Wall facing 270...;Wall facing 180...;Wall facing 90...;Wall facing 0...;"
"Ceiling...;Ground surface...;-;About...";
return "About;-;Wall facing 270...;Wall facing 180...;Wall facing 90...;Wall facing 0...;"
"Ceiling...;Ground surface...";
}
// vMin/vMax provide the bounds of the selection, they are zero if there is no selection
@ -129,7 +129,7 @@ void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrus
}
Generate = true;
}
else if ( !strcmp( p,"About..." ) ) {
else if ( !strcmp( p,"About" ) ) {
About( g_pRadiantWnd );
}

View file

@ -394,7 +394,8 @@ void CreateViewWindow(){
gtk_widget_show( vbox );
#ifndef ISOMETRIC
hbox = gtk_hbox_new( TRUE, 5 );
hbox = gtk_hbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 );
gtk_widget_show( hbox );

View file

@ -334,7 +334,7 @@ void UpdateWadKeyPair( void ){
const char *PLUGIN_NAME = "HydraToolz";
// commands in the menu
const char *PLUGIN_COMMANDS = "About...;Create/Update WAD keypair";
const char *PLUGIN_COMMANDS = "About;-;Create/Update WAD keypair";
const char *PLUGIN_ABOUT = "HydraToolz v1.0 for GTKRadiant\n\n"
"By Hydra!";
@ -362,7 +362,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool
if ( !strcmp( p, "Create/Update WAD keypair" ) ) {
UpdateWadKeyPair();
}
else if ( !strcmp( p, "About..." ) ) {
else if ( !strcmp( p, "About" ) ) {
g_FuncTable.m_pfnMessageBox( g_pMainWidget, PLUGIN_ABOUT, "About", MB_OK, NULL );
}
}

View file

@ -41,7 +41,7 @@ void DoAboutDlg( GtkWidget *parent ){
content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent) );
vbox = gtk_vbox_new( TRUE, 5 );
vbox = gtk_vbox_new( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( content_area ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );

View file

@ -420,7 +420,8 @@ void DoConfigDialog( GtkWidget *parent ){
gtk_widget_show( cliplabel );
g_signal_connect( adj, "value-changed", G_CALLBACK( OnScrollClip ), cliplabel );
hbox = gtk_hbox_new( TRUE, 5 );
hbox = gtk_hbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );

View file

@ -613,7 +613,8 @@ void DoConfigDialog(){
gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 );
g_signal_connect( adj, "value-changed", G_CALLBACK( OnScrollClip ), cliplabel );
hbox = gtk_hbox_new( TRUE, 5 );
hbox = gtk_hbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );

View file

@ -25,7 +25,7 @@
#include <stdlib.h>
#define Q3R_CMD_SPLITTER "-"
#define Q3R_CMD_ABOUT "About Portal Viewer..."
#define Q3R_CMD_ABOUT "About"
#define Q3R_CMD_LOAD "Load .prt file"
#define Q3R_CMD_RELEASE "Unload .prt file"
#define Q3R_CMD_SHOW_3D "Toggle portals (3D)"

View file

@ -77,6 +77,7 @@ virtual ~IRender() { }
virtual void IncRef() = 0; // increments the reference counter for this object
virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero
virtual void Draw( int state, int rflags ) const = 0; // render the object - state = the opengl state
virtual const bool IsModelNotNull() const = 0;
virtual const aabb_t *GetAABB() const = 0;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

View file

@ -40,6 +40,7 @@ class CEntityMiscModel : public IRender, public ISelect, public IEdit
// IRender
void Draw( int state, int rflags ) const;
const bool IsModelNotNull() const { return m_model && m_model->pRender; }
const aabb_t *GetAABB() const { return &m_BBox; }
// ISelect
@ -105,6 +106,7 @@ class CEntityEclassModel : public IRender, public ISelect, public IEdit
// IRender
void Draw( int state, int rflags ) const;
const bool IsModelNotNull() const { return m_model && m_model->pRender; }
const aabb_t *GetAABB() const { return &m_BBox; }
// ISelect

View file

@ -66,6 +66,7 @@ void Reload( void );
void Draw( int state, vector<IShader*> shaders, int rflags ) const;
//IRender
virtual void Draw( int state, int rflags ) const;
virtual const bool IsModelNotNull() const { return true; }
virtual const aabb_t *GetAABB() const { return &m_BBox; }
//ISelect

View file

@ -141,6 +141,9 @@ virtual void DecRef(){
virtual void Draw( int state, int rflags ) const {
m_model->Draw( state, m_shaders, rflags );
}
virtual const bool IsModelNotNull() const {
return m_model != NULL;
}
virtual const aabb_t *GetAABB() const {
return m_model->GetAABB();
}
@ -300,6 +303,9 @@ virtual void DecRef(){
virtual void Draw( int state, int rflags ) const {
m_model->Draw( state, rflags );
}
virtual const bool IsModelNotNull() const {
return m_model != NULL;
}
virtual const aabb_t *GetAABB() const {
return m_model->GetAABB();
}

View file

@ -148,7 +148,7 @@ _QERShadersTable g_ShadersTable;
static const char *PLUGIN_NAME = "Sprite Model loading module";
static const char *PLUGIN_COMMANDS = "About...";
static const char *PLUGIN_COMMANDS = "About";
static const char *PLUGIN_ABOUT = "Sprite Model loading module v0.2 for GTKRadiant\n\n"
"By Hydra!";
@ -200,7 +200,7 @@ extern "C" const char* QERPlug_GetCommandList(){
extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){
// NOTE: this never happens in a module
if ( !strcmp( p, "About..." ) ) {
if ( !strcmp( p, "About" ) ) {
g_FuncTable.m_pfnMessageBox( g_pMainWidget, PLUGIN_ABOUT, "About", MB_OK, NULL );
}
}

View file

@ -45,6 +45,7 @@ void DecRef() {
//IRender
void Draw( int state, int rflags ) const;
const bool IsModelNotNull() const { return true; }
const aabb_t *GetAABB() const { return &m_BBox; }
//ISelect

View file

@ -119,22 +119,22 @@ bool C2DView::OnRButtonUp( int x, int y ){
item = gtk_menu_item_new_with_label( _( "Validate (RETURN)" ) );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( Textool_Validate ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
item = gtk_menu_item_new_with_label( _( "Zoom in (INSERT)" ) );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( view_ZoomIn ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
item = gtk_menu_item_new_with_label( _( "Zoom out (DELETE)" ) );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( view_ZoomOut ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
item = gtk_menu_item_new_with_label( _( "Cancel (ESC)" ) );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( Textool_Cancel ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
gtk_menu_popup( GTK_MENU( menu ), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME );
}

View file

@ -37,7 +37,7 @@ _QERFuncTable_1 g_FuncTable;
const char *PLUGIN_NAME = "Q3 Texture Tools";
// commands in the menu
const char *PLUGIN_COMMANDS = "About...;Go...";
const char *PLUGIN_COMMANDS = "About;-;Go...";
// cast to GtkWidget*
void *g_pMainWnd;
@ -775,8 +775,8 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool
}
#endif
if ( !strcmp( p, "About..." ) ) {
DoMessageBox( PLUGIN_ABOUT, "About ...", MB_OK );
if ( !strcmp( p, "About" ) ) {
DoMessageBox( PLUGIN_ABOUT, "About", MB_OK );
}
else if ( !strcmp( p, "Go..." ) ) {
if ( !g_pToolWnd ) {

View file

@ -2222,7 +2222,8 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag
if ( b->owner->eclass->fixedsize
&& b->owner->model.pSelect
&& !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) )
&& g_PrefsDlg.m_nEntityShowState != ENTITY_BOX ) {
&& g_PrefsDlg.m_nEntityShowState != ENTITY_BOX
&& b->owner->model.pRender->IsModelNotNull() ) {
ray_t ray_local;
vec_t dist_local = FLT_MAX;
ray_construct_for_vec3( &ray_local, origin, dir );
@ -2259,8 +2260,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag
for ( i = 0 ; i < 3 ; i++ )
p1[i] = p1[i] + frac * ( p2[i] - p1[i] );
}
else
{
else {
for ( i = 0 ; i < 3 ; i++ )
p2[i] = p1[i] + frac * ( p2[i] - p1[i] );
}
@ -2640,8 +2640,9 @@ void Brush_SelectFaceForDragging( brush_t *b, face_t *f, qboolean shear ){
// leave it alone
//
if ( i != w->numpoints ) {
if ( i == 0 ) { // see if the first clockwise point was the
// see if the first clockwise point was the
// last point on the winding
if ( i == 0 ) {
d = DotProduct( w->points[w->numpoints - 1]
, f->plane.normal ) - f->plane.dist;
if ( d > -ON_EPSILON && d < ON_EPSILON ) {

View file

@ -925,13 +925,25 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){
if ( !( nGLState & DRAW_GL_TEXTURE_2D ) ) {
qglColor4fv( material );
}
else{ qglColor4fv( identity ); }
else {
qglColor4fv( identity );
}
if ( nGLState & DRAW_GL_LIGHTING ) {
qglShadeModel( GL_SMOOTH );
}
// Check model validity
// If the model is NULL or invalid, draw a box instead
bool isModelValid = b->owner->model.pRender->IsModelNotNull();
if ( isModelValid ) {
b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM );
}
else {
qglColor4fv( material );
aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE );
}
}
break;
case DRAW_WIRE:
VectorCopy( b->owner->eclass->color, material );

View file

@ -35,8 +35,6 @@
#include "groupdialog.h"
GtkWidget* EntWidgets[EntLast];
GtkListStore* g_entlist_store;
GtkListStore* g_entprops_store;
int inspector_mode; // W_TEXTURE, W_ENTITY, or W_CONSOLE
qboolean multiple_entities;
qboolean disable_spawn_get = false;
@ -90,7 +88,10 @@ static void entity_check( GtkWidget *widget, gpointer data );
*/
void FillClassList(){
GtkListStore* store = g_entlist_store;
GtkListStore *store;
GtkTreeModel * model;
model = GTK_TREE_MODEL( gtk_tree_view_get_model( GTK_TREE_VIEW( EntWidgets[EntList] ) ) );
store = GTK_LIST_STORE( model );
gtk_list_store_clear( store );
@ -109,7 +110,10 @@ void FillClassList(){
//
void SetKeyValuePairs( bool bClearMD3 ){
GtkListStore* store = g_entprops_store;
GtkListStore *store;
GtkTreeModel * model;
model = GTK_TREE_MODEL( gtk_tree_view_get_model( GTK_TREE_VIEW( EntWidgets[EntProps] ) ) );
store = GTK_LIST_STORE( model );
gtk_list_store_clear( store );
@ -347,7 +351,7 @@ bool UpdateEntitySel( eclass_t *pec ){
Sys_FPrintf( SYS_WRN, "UpdateEntitySel\n" );
#endif
GtkTreeModel* model = GTK_TREE_MODEL( g_entlist_store );
GtkTreeModel* model = GTK_TREE_MODEL( gtk_tree_view_get_model( GTK_TREE_VIEW( EntWidgets[EntList] ) ) );
GtkTreeIter iter;
unsigned int i = 0;
for ( gboolean good = gtk_tree_model_get_iter_first( model, &iter ); good != FALSE; good = gtk_tree_model_iter_next( model, &iter ) )
@ -1059,12 +1063,21 @@ static gint eclasslist_keypress( GtkWidget* widget, GdkEventKey* event, gpointer
return FALSE;
}
static void proplist_selection_changed( GtkTreeSelection* selection, gpointer data ){
// find out what type of entity we are trying to create
GtkTreeModel* model;
GtkTreeIter iter;
if ( gtk_tree_selection_get_selected( selection, &model, &iter ) == FALSE ) {
GtkWidget *dialog, *del_button;
gboolean selected;
dialog = GTK_WIDGET( data );
del_button = GTK_WIDGET( g_object_get_data( G_OBJECT( dialog ), "del_button" ) );
selected = gtk_tree_selection_get_selected( selection, &model, &iter );
gtk_widget_set_sensitive( del_button, selected );
if ( selected == FALSE ) {
return;
}
@ -1078,6 +1091,10 @@ static void proplist_selection_changed( GtkTreeSelection* selection, gpointer da
g_free( key );
g_free( val );
}
static void proplist_view_realize( GtkWidget *widget, gpointer data )
{
proplist_selection_changed( gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ) ), data );
}
static void entity_check( GtkWidget *widget, gpointer data ){
if ( !disable_spawn_get ) {
@ -1215,30 +1232,34 @@ extern void PositionWindowOnPrimaryScreen( window_position_t& position );
#endif
void GroupDlg::Create(){
GtkWidget *dialog, *content_area;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
if ( m_pWidget != NULL ) {
return;
}
GtkWidget* dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
dialog = gtk_dialog_new_with_buttons( _( "Entities/Entity View" ), NULL, flags, NULL );
content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
#ifdef _WIN32
if ( g_PrefsDlg.m_bStartOnPrimMon ) {
PositionWindowOnPrimaryScreen( g_PrefsDlg.mWindowInfo.posEntityWnd );
}
#endif
load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posEntityWnd );
load_window_pos( dialog, g_PrefsDlg.mWindowInfo.posEntityWnd );
gtk_window_set_title( GTK_WINDOW( dlg ), _( "Entities" ) );
g_signal_connect( G_OBJECT( dlg ), "delete-event", G_CALLBACK( OnDeleteHide ), NULL );
g_signal_connect( G_OBJECT( dialog ), "delete-event", G_CALLBACK( OnDeleteHide ), NULL );
// catch 'Esc'
g_signal_connect( G_OBJECT( dlg ), "key-press-event", G_CALLBACK( OnDialogKey ), NULL );
g_signal_connect( G_OBJECT( dialog ), "key-press-event", G_CALLBACK( OnDialogKey ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) );
g_qeglobals_gui.d_entity = dlg;
gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) );
g_qeglobals_gui.d_entity = dialog;
{
GtkWidget* notebook = gtk_notebook_new();
gtk_container_add( GTK_CONTAINER( dlg ), notebook );
gtk_container_add( GTK_CONTAINER( content_area ), notebook );
gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_BOTTOM );
gtk_widget_show( notebook );
m_pNotebook = notebook;
@ -1261,20 +1282,20 @@ void GroupDlg::Create(){
{
GtkWidget* split2 = gtk_vpaned_new();
gtk_paned_add1( GTK_PANED( split1 ), split2 );
gtk_paned_pack1( GTK_PANED( split1 ), split2, TRUE, FALSE );
gtk_widget_show( split2 );
g_object_set_data( G_OBJECT( dlg ), "split1", split1 );
g_object_set_data( G_OBJECT( dlg ), "split2", split2 );
g_object_set_data( G_OBJECT( dialog ), "split1", split1 );
g_object_set_data( G_OBJECT( dialog ), "split2", split2 );
{
GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 );
gtk_paned_pack2( GTK_PANED( split1 ), vbox2, FALSE, FALSE );
gtk_paned_pack2( GTK_PANED( split1 ), vbox2, TRUE, FALSE );
gtk_widget_show( vbox2 );
{
GtkWidget* scr = gtk_scrolled_window_new( NULL, NULL );
gtk_paned_add1( GTK_PANED( split2 ), scr );
gtk_paned_pack1( GTK_PANED( split2 ), scr, TRUE, FALSE );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
gtk_widget_show( scr );
@ -1295,22 +1316,21 @@ void GroupDlg::Create(){
{
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( eclasslist_selection_changed ), dlg );
g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( eclasslist_selection_changed ), dialog );
}
gtk_widget_show( view );
gtk_container_add( GTK_CONTAINER( scr ), view );
gtk_widget_show( view );
g_object_unref( G_OBJECT( store ) );
EntWidgets[EntList] = view;
g_entlist_store = store;
}
}
{
GtkWidget* scr = gtk_scrolled_window_new( NULL, NULL );
gtk_paned_add2( GTK_PANED( split2 ), scr );
gtk_paned_pack2( GTK_PANED( split2 ), scr, TRUE, FALSE );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
gtk_widget_show( scr );
@ -1369,17 +1389,16 @@ void GroupDlg::Create(){
{
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( proplist_selection_changed ), dlg );
g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( proplist_selection_changed ), dialog );
g_signal_connect( G_OBJECT( view ), "realize", G_CALLBACK( proplist_view_realize ), dialog );
}
gtk_container_add( GTK_CONTAINER( scr ), view );
gtk_widget_show( view );
g_object_unref( G_OBJECT( store ) );
EntWidgets[EntProps] = view;
g_entprops_store = store;
}
}
}
@ -1539,9 +1558,9 @@ void GroupDlg::Create(){
{
GtkWidget* button = gtk_button_new_with_label( _( "Reset" ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( ResetEntity ), NULL );
gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 );
}
{
@ -1570,6 +1589,7 @@ void GroupDlg::Create(){
gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( DelProp ), NULL );
g_object_set_data( G_OBJECT( dialog ), "del_button", button );
}
{
@ -1630,7 +1650,7 @@ void GroupDlg::Create(){
}
inspector_mode = W_ENTITY;
m_pWidget = dlg;
g_signal_connect( G_OBJECT( notebook ), "switch-page", G_CALLBACK( switch_page ), dlg );
m_pWidget = dialog;
g_signal_connect( G_OBJECT( notebook ), "switch-page", G_CALLBACK( switch_page ), dialog );
}
}

View file

@ -1129,6 +1129,41 @@ static void entitylist_select( GtkWidget *widget, gpointer data ){
}
}
static void add_entity_selection( entity_t *pEntity ) {
if( pEntity ) {
for ( epair_t* pEpair = pEntity->epairs; pEpair; pEpair = pEpair->next )
{
Select_Brush( pEntity->brushes.onext );
}
}
}
static void entitylist_selected_foreach( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data ) {
entity_t* pEntity;
gtk_tree_model_get( model, iter, 1, &pEntity, -1 );
add_entity_selection( pEntity );
//if parent (classname) node is selected then all child nodes are included
if( !pEntity ) {
GtkTreeIter child;
unsigned int i = 0;
while( gtk_tree_model_iter_nth_child( model, &child, iter, i++ ) ) {
gtk_tree_model_get( model, &child, 1, &pEntity, -1 );
add_entity_selection( pEntity );
}
}
}
static void entitylist_multiselect( GtkWidget *widget, gpointer data ) {
GtkTreeView *view = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( data ), "entities" ) );
GtkTreeSelection *selection = gtk_tree_view_get_selection( view );
Select_Deselect();
gtk_tree_selection_selected_foreach( selection, entitylist_selected_foreach, NULL );
Sys_UpdateWindows( W_ALL );
}
static gint entitylist_click( GtkWidget *widget, GdkEventButton *event, gpointer data ){
if ( event->type == GDK_2BUTTON_PRESS ) {
entitylist_select( NULL, data );
@ -1137,17 +1172,43 @@ static gint entitylist_click( GtkWidget *widget, GdkEventButton *event, gpointer
return FALSE;
}
static void entitylist_selection_changed( GtkTreeSelection* selection, gpointer data ){
GtkTreeModel *model;
GtkTreeIter selected;
GtkTreeIter child;
entity_t *pEntity = NULL;
entity_t *firstEntity = NULL;
GtkListStore* store = GTK_LIST_STORE( g_object_get_data( G_OBJECT( data ), "keyvalues" ) );
GtkWidget *notebook = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "notebook" );
GtkWidget *keyvalue_page = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "keyvalue_page" );
GtkWidget *desc_page = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "description_page" );
GtkWidget *textview = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "description_textview" );
gtk_list_store_clear( store );
GtkTreeModel* model;
GtkTreeIter selected;
if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
if ( gtk_tree_selection_get_mode( selection ) == GTK_SELECTION_MULTIPLE ) {
GList *rows, *last;
rows = gtk_tree_selection_get_selected_rows( selection, &model );
//only the keys/values of the last selected node with entity
last = g_list_last( rows );
if ( last ) {
if ( gtk_tree_model_get_iter( model, &selected, (GtkTreePath *)last->data ) == TRUE ) {
gtk_tree_model_get( model, &selected, 1, &pEntity, -1 );
if ( !pEntity ) {
if( gtk_tree_model_iter_nth_child( model, &child, &selected, 0 ) ) {
gtk_tree_model_get( model, &child, 1, &firstEntity, -1 );
}
}
}
}
g_list_free_full( rows, (GDestroyNotify)gtk_tree_path_free );
} else if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
entity_t* pEntity;
gtk_tree_model_get( model, &selected, 1, &pEntity, -1 );
}
if ( pEntity ) {
for ( epair_t* pEpair = pEntity->epairs; pEpair; pEpair = pEpair->next )
{
@ -1155,8 +1216,18 @@ static void entitylist_selection_changed( GtkTreeSelection* selection, gpointer
gtk_list_store_append( store, &appended );
gtk_list_store_set( store, &appended, 0, pEpair->key, 1, pEpair->value, -1 );
}
gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), gtk_notebook_page_num( GTK_NOTEBOOK( notebook ), keyvalue_page ) );
} else {
GtkTextBuffer *buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( textview ) );
if( firstEntity && firstEntity->eclass && firstEntity->eclass->comments ) {
gtk_text_buffer_set_text( buffer, firstEntity->eclass->comments, -1 );
} else {
gtk_text_buffer_set_text( buffer, _( "No description available." ), -1 );
}
gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), gtk_notebook_page_num( GTK_NOTEBOOK( notebook ), desc_page ) );
}
}
static void EnitityList_response( GtkDialog *dialog, gint response_id, gpointer user_data )
@ -1169,7 +1240,9 @@ static void EnitityList_response( GtkDialog *dialog, gint response_id, gpointer
}
void DoEntityList(){
static GtkWidget *dialog;
GtkWidget *vbox, *hbox, *hbox2, *button, *scr, *content_area;
GtkWidget *vbox, *hbox, *hbox2, *button, *scr, *content_area, *paned;
GtkWidget *notebook, *label, *textview, *keyvalue_scr, *desc_scr;
gint keyvalue_index;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
if ( EntityList_dialog != NULL ) {
@ -1185,13 +1258,12 @@ void DoEntityList(){
content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
hbox = gtk_hbox_new( TRUE, 5 );
gtk_container_add( GTK_CONTAINER( content_area ), hbox );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
gtk_widget_show( hbox );
paned = gtk_hpaned_new();
gtk_box_pack_start( GTK_BOX( content_area ), paned, TRUE, TRUE, 0 );
gtk_widget_show( paned );
scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL );
gtk_box_pack_start( GTK_BOX( hbox ), scr, TRUE, TRUE, 0 );
gtk_paned_pack1( GTK_PANED( paned ), scr, FALSE, TRUE );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
gtk_widget_show( scr );
@ -1211,6 +1283,7 @@ void DoEntityList(){
{
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( entitylist_selection_changed ), dialog );
}
@ -1276,11 +1349,20 @@ void DoEntityList(){
}
vbox = gtk_vbox_new( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 );
gtk_paned_pack2( GTK_PANED( paned ), vbox, FALSE, TRUE );
gtk_widget_show( vbox );
scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL );
gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 );
notebook = gtk_notebook_new();
// hide the notebook tabs since its not supposed to look like a notebook
gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook ), FALSE );
gtk_box_pack_start( GTK_BOX( vbox ), notebook, TRUE, TRUE, 0 );
gtk_widget_show( notebook );
label = gtk_label_new( _( "Keys/Values" ) );
gtk_widget_show( label );
keyvalue_scr = scr = gtk_scrolled_window_new( NULL, NULL );
keyvalue_index = gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), scr, label );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
gtk_widget_show( scr );
@ -1310,6 +1392,29 @@ void DoEntityList(){
g_object_unref( G_OBJECT( store ) );
}
label = gtk_label_new( _( "Description" ) );
gtk_widget_show( label );
desc_scr = scr = gtk_scrolled_window_new( NULL, NULL );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), scr, label );
gtk_widget_show( scr );
textview = gtk_text_view_new();
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( textview ), GTK_WRAP_WORD );
gtk_text_view_set_editable( GTK_TEXT_VIEW( textview ), FALSE );
gtk_container_add( GTK_CONTAINER( scr ), textview );
gtk_widget_show( textview );
gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), keyvalue_index );
g_object_set_data( G_OBJECT( dialog ), "notebook", notebook );
g_object_set_data( G_OBJECT( dialog ), "keyvalue_page", keyvalue_scr );
g_object_set_data( G_OBJECT( dialog ), "description_page", desc_scr );
g_object_set_data( G_OBJECT( dialog ), "description_textview", textview );
hbox2 = gtk_hbox_new( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 );
gtk_widget_show( hbox2 );
@ -1317,7 +1422,7 @@ void DoEntityList(){
button = gtk_button_new_with_label( _( "Select" ) );
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( entitylist_select ), dialog );
G_CALLBACK( entitylist_multiselect ), dialog );
gtk_widget_set_size_request( button, 60, -1 );
gtk_widget_show( button );
@ -1481,7 +1586,8 @@ void DoGamma(){
content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
vbox = gtk_vbox_new( TRUE, 5 );
vbox = gtk_vbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE );
gtk_container_add( GTK_CONTAINER( content_area ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
@ -3428,7 +3534,8 @@ int DoLightIntensityDlg( int *intensity ){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label );
hbox = gtk_hbox_new( TRUE, 5 );
hbox = gtk_hbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
gtk_widget_show( hbox );

View file

@ -660,15 +660,16 @@ GtkWidget* new_image_icon( const char* filename ) {
str += filename;
pixbuf = gdk_pixbuf_new_from_file( str.GetBuffer(), &gerror );
if( pixbuf == NULL ) {
if( pixbuf != NULL ) {
icon = gtk_image_new_from_pixbuf( pixbuf );
g_object_unref( pixbuf );
} else {
Sys_FPrintf( SYS_ERR, "ERROR: Failed to load bitmap: %s, %s\n", str.GetBuffer(), gerror->message );
g_error_free( gerror );
icon = gtk_image_new_from_file( filename );
}
icon = gtk_image_new_from_pixbuf( pixbuf );
gtk_widget_show( icon );
if( pixbuf ) {
g_object_unref( pixbuf );
}
return icon;
}

View file

@ -27,9 +27,6 @@
#include "stdafx.h"
#ifdef _WIN32
extern "C" {
#include <gdk/gdkwin32.h>
}
#endif
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@ -1542,7 +1539,7 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){
item = create_menu_item_with_mnemonic( menu, _( "Simple Patch Mesh..." ),
G_CALLBACK( HandleCommand ), ID_CURVE_SIMPLEPATCHMESH );
g_object_set_data( G_OBJECT( window ), "menu_simplepatchmesh", item );
create_menu_item_with_mnemonic( menu, _( "Patch Inspector" ), G_CALLBACK( HandleCommand ), ID_PATCH_INSPECTOR );
create_menu_item_with_mnemonic( menu, _( "Patch Inspector..." ), G_CALLBACK( HandleCommand ), ID_PATCH_INSPECTOR );
menu_separator( menu );
menu_in_menu = create_menu_in_menu_with_mnemonic( menu, _( "Insert" ) );
create_menu_item_with_mnemonic( menu_in_menu, _( "Insert (2) Columns" ),
@ -1822,7 +1819,7 @@ void MainFrame::create_main_toolbar( GtkWidget *window, GtkWidget *vbox ){
G_CALLBACK( HandleCommand ), GINT_TO_POINTER( ID_SELECTION_MAKEHOLLOW ) );
g_object_set_data( G_OBJECT( window ), "tb_selection_makehollow", w );
w = toolbar_append_item( GTK_TOOLBAR( toolbar ), "", _( "Hollow Touch" ), "",
new_image_icon("selection_makehollow.png"),
new_image_icon("selection_makehollowtouch.png"),
G_CALLBACK( HandleCommand ), GINT_TO_POINTER( ID_SELECTION_MAKEHOLLOW_TOUCH ) );
g_object_set_data( G_OBJECT( window ), "tb_selection_makehollow_touch", w );
@ -3234,26 +3231,7 @@ static void Sys_Restore( GtkWidget *w ){
return;
}
#if defined ( __linux__ ) || defined ( __APPLE__ )
Sys_FPrintf( SYS_WRN, "FIXME: Sys_Restore\n" );
#if 0
XWindowAttributes xattr;
GdkWindowPrivate *Private;
Private = (GdkWindowPrivate*)gtk_widget_get_window( w );
xattr.map_state = IsUnmapped;
XGetWindowAttributes( Private->xdisplay, Private->xwindow, &xattr );
if ( xattr.map_state == IsUnmapped ) {
XMapRaised( Private->xdisplay, Private->xwindow );
}
#endif
#endif
#ifdef _WIN32
ShowWindow( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( w ) ), SW_RESTORE );
#endif
gtk_window_deiconify( GTK_WINDOW( w ) );
}
#ifdef _DEBUG

View file

@ -659,7 +659,8 @@ void PatchDialog::BuildDialog(){
gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right
gtk_widget_show( spin );
hbox2 = gtk_hbox_new( TRUE, 5 );
hbox2 = gtk_hbox_new( FALSE, 5 );
gtk_box_set_homogeneous( GTK_BOX( hbox2 ), TRUE );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, TRUE, FALSE, 0 );
gtk_widget_show( hbox2 );

View file

@ -3403,37 +3403,49 @@ void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) {
g_free( str );
i->UpdateData( FALSE );
GtkWidget *label = GTK_WIDGET( g_object_get_data( G_OBJECT( i->m_pWidget ), "executable_label" ) );
GtkWidget *entry = GTK_WIDGET( g_object_get_data( G_OBJECT( i->m_pWidget ), "executable_entry" ) );
GtkWidget *button = GTK_WIDGET( g_object_get_data( G_OBJECT( i->m_pWidget ), "executable_button" ) );
int game_id = i->m_availGames[ i->m_nComboSelect ];
if ( game_id == GAME_Q2 || game_id == GAME_QUETOO ) {
gtk_widget_show( i->m_executablesVBox );
gtk_widget_show( label );
gtk_widget_show( entry );
gtk_widget_show( button );
} else {
gtk_widget_hide( i->m_executablesVBox );
gtk_widget_hide( label );
gtk_widget_hide( entry );
gtk_widget_hide( button );
}
}
void CGameInstall::BuildDialog() {
GtkWidget *dlg, *vbox1, *frame, *vbox2, *button, *text, *game_select_combo, *entry, *hbox;
GtkWidget *dlg, *vbox1, *frame, *table, *button, *text, *game_select_combo, *entry, *hbox;
dlg = m_pWidget;
gtk_window_set_title( GTK_WINDOW( dlg ), _( "Configure games" ) );
vbox1 = gtk_vbox_new( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox1 ), 5 );
gtk_widget_show( vbox1 );
gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
gtk_widget_show( vbox1 );
frame = gtk_frame_new( _( "Configure a game" ) );
gtk_box_pack_start( GTK_BOX( vbox1 ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
gtk_container_add( GTK_CONTAINER( vbox1 ), frame );
vbox2 = gtk_vbox_new( FALSE, 5);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
table = gtk_table_new( 5, 2, FALSE );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_widget_show( table );
game_select_combo = gtk_combo_box_text_new();
gtk_table_attach( GTK_TABLE( table ), game_select_combo, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( game_select_combo );
gtk_box_pack_start( GTK_BOX( vbox2 ), game_select_combo, FALSE, FALSE, 0 );
int iGame = 0;
while ( m_availGames[ iGame ] != GAME_NONE ) {
@ -3490,66 +3502,82 @@ void CGameInstall::BuildDialog() {
g_signal_connect( G_OBJECT( game_select_combo ), "changed", G_CALLBACK( OnGameSelectChanged ), this );
text = gtk_label_new( _( "Name:" ) );
gtk_misc_set_alignment( GTK_MISC( text ), 0.0, 0.5 );
gtk_table_attach( GTK_TABLE( table ), text, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( text );
gtk_box_pack_start( GTK_BOX( vbox2 ), text, FALSE, FALSE, 0 );
entry = gtk_entry_new();
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( vbox2 ), entry, FALSE, FALSE, 0 );
AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
text = gtk_label_new( _( "Game directory:" ) );
gtk_misc_set_alignment( GTK_MISC( text ), 0.0, 0.5 );
gtk_table_attach( GTK_TABLE( table ), text, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( text );
gtk_box_pack_start( GTK_BOX( vbox2 ), text, FALSE, FALSE, 0 );
hbox = gtk_hbox_new( FALSE, 5 );
gtk_table_attach( GTK_TABLE( table ), hbox, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, FALSE, FALSE, 0 );
entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 );
gtk_widget_show( entry );
AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
button = gtk_button_new_with_label( _( "..." ) );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnBrowseEngine ), this );
gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
m_executablesVBox = gtk_vbox_new( TRUE, 0 );
gtk_box_pack_start( GTK_BOX( vbox2 ), m_executablesVBox, FALSE, FALSE, 0 );
gtk_widget_show( m_executablesVBox );
gtk_widget_show( button );
text = gtk_label_new( _( "Engine binaries directory:" ) );
gtk_misc_set_alignment( GTK_MISC( text ), 0.0, 0.5 );
gtk_table_attach( GTK_TABLE( table ), text, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( text );
gtk_box_pack_start( GTK_BOX( m_executablesVBox ), text, FALSE, FALSE, 0 );
g_object_set_data( G_OBJECT( dlg ), "executable_label", text );
hbox = gtk_hbox_new( FALSE, 5 );
gtk_table_attach( GTK_TABLE( table ), hbox, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( m_executablesVBox ), hbox, FALSE, FALSE, 0 );
entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 );
gtk_widget_show( entry );
AddDialogData( entry, &m_strExecutables, DLG_ENTRY_TEXT );
g_object_set_data( G_OBJECT( dlg ), "executable_entry", entry );
button = gtk_button_new_with_label( _( "..." ) );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnBrowseExecutables ), this );
gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
gtk_widget_show( button );
g_object_set_data( G_OBJECT( dlg ), "executable_button", button );
hbox = gtk_hbox_new( FALSE, 0 );
gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
button = gtk_button_new_with_label( _( "OK" ) );
gtk_box_pack_start( GTK_BOX( hbox ), button, TRUE, TRUE, 0 );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, TRUE, TRUE, 0 );
AddModalButton( button, IDOK );
button = gtk_button_new_with_label( _( "Cancel" ) );
gtk_box_pack_start( GTK_BOX( hbox ), button, TRUE, TRUE, 0 );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, TRUE, TRUE, 0 );
AddModalButton( button, IDCANCEL );
gtk_widget_set_size_request( dlg, 320, -1 );
// triggers the callback - sets the game name, shows/hide extra settings depending on project
gtk_combo_box_set_active( GTK_COMBO_BOX( game_select_combo ), 0 );
}

View file

@ -275,7 +275,6 @@ protected:
// maps from m_nComboSelect to the games
int m_availGames[GAME_COUNT];
GtkWidget * m_executablesVBox;
};
/*!

View file

@ -32,12 +32,7 @@
- Make sure the interface is not dependent on gtk.
*/
#ifdef _WIN32
//#include <gdk/win32/gdkwin32.h>
#include <gdk/gdkwin32.h>
#endif
#if defined ( __linux__ ) || defined ( __APPLE__ )
#include <gdk/gdkx.h>
#include <dirent.h>
#endif
#include <gtk/gtk.h>

View file

@ -31,10 +31,6 @@
#include <assert.h>
#include <GL/gl.h>
#ifdef _WIN32
#include <gdk/gdkwin32.h>
#endif
// =============================================================================
// variables