mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Merge branch 'deprchild' of git://github.com/Pan7/GtkRadiant into Pan7-deprchild
This commit is contained in:
commit
7cd6a22c52
9 changed files with 68 additions and 43 deletions
|
@ -206,28 +206,28 @@ void FindTextureDialog::BuildDialog(){
|
||||||
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
||||||
g_signal_connect( G_OBJECT( button ), "clicked",
|
g_signal_connect( G_OBJECT( button ), "clicked",
|
||||||
G_CALLBACK( OnFind ), NULL );
|
G_CALLBACK( OnFind ), NULL );
|
||||||
gtk_widget_set_usize( button, 60, -2 );
|
gtk_widget_set_size_request( button, 60, -1 );
|
||||||
gtk_widget_show( button );
|
gtk_widget_show( button );
|
||||||
|
|
||||||
button = gtk_button_new_with_label( _( "OK" ) );
|
button = gtk_button_new_with_label( _( "OK" ) );
|
||||||
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
||||||
g_signal_connect( G_OBJECT( button ), "clicked",
|
g_signal_connect( G_OBJECT( button ), "clicked",
|
||||||
G_CALLBACK( OnOK ), NULL );
|
G_CALLBACK( OnOK ), NULL );
|
||||||
gtk_widget_set_usize( button, 60, -2 );
|
gtk_widget_set_size_request( button, 60, -1 );
|
||||||
gtk_widget_show( button );
|
gtk_widget_show( button );
|
||||||
|
|
||||||
button = gtk_button_new_with_label( _( "Apply" ) );
|
button = gtk_button_new_with_label( _( "Apply" ) );
|
||||||
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
||||||
g_signal_connect( G_OBJECT( button ), "clicked",
|
g_signal_connect( G_OBJECT( button ), "clicked",
|
||||||
G_CALLBACK( OnApply ), NULL );
|
G_CALLBACK( OnApply ), NULL );
|
||||||
gtk_widget_set_usize( button, 60, -2 );
|
gtk_widget_set_size_request( button, 60, -1 );
|
||||||
|
gtk_widget_show( button );
|
||||||
|
|
||||||
button = gtk_button_new_with_label( _( "Close" ) );
|
button = gtk_button_new_with_label( _( "Close" ) );
|
||||||
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
|
||||||
g_signal_connect( G_OBJECT( button ), "clicked",
|
g_signal_connect( G_OBJECT( button ), "clicked",
|
||||||
G_CALLBACK( OnClose ), NULL );
|
G_CALLBACK( OnClose ), NULL );
|
||||||
gtk_widget_set_usize( button, 60, -2 );
|
gtk_widget_set_size_request( button, 60, -1 );
|
||||||
|
|
||||||
gtk_widget_show( dlg );
|
gtk_widget_show( dlg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,10 +307,12 @@ bool UpdateSel( int iIndex, eclass_t *pec ){
|
||||||
// NOTE: these boxes might not even be on display
|
// NOTE: these boxes might not even be on display
|
||||||
for ( i = 0; i < last_count; i++ )
|
for ( i = 0; i < last_count; i++ )
|
||||||
{
|
{
|
||||||
GtkWidget* widget = EntWidgets[EntCheck1 + i];
|
GtkWidget *widget = EntWidgets[EntCheck1 + i];
|
||||||
gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), " " );
|
|
||||||
gtk_widget_hide( widget );
|
gtk_button_set_label( GTK_BUTTON( widget ), " " );
|
||||||
|
|
||||||
g_object_ref( widget );
|
g_object_ref( widget );
|
||||||
|
gtk_widget_hide( widget );
|
||||||
gtk_container_remove( GTK_CONTAINER( LayoutTable ), widget );
|
gtk_container_remove( GTK_CONTAINER( LayoutTable ), widget );
|
||||||
}
|
}
|
||||||
last_count = spawnflag_count;
|
last_count = spawnflag_count;
|
||||||
|
@ -330,7 +332,7 @@ bool UpdateSel( int iIndex, eclass_t *pec ){
|
||||||
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
|
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
|
||||||
g_object_unref( widget );
|
g_object_unref( widget );
|
||||||
|
|
||||||
gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), str.GetBuffer() );
|
gtk_button_set_label( GTK_BUTTON( widget ), str.GetBuffer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSpawnFlags();
|
SetSpawnFlags();
|
||||||
|
@ -1206,7 +1208,6 @@ static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data )
|
||||||
|
|
||||||
GroupDlg::GroupDlg (){
|
GroupDlg::GroupDlg (){
|
||||||
m_pWidget = NULL;
|
m_pWidget = NULL;
|
||||||
m_hWorld = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -96,7 +96,6 @@ public:
|
||||||
GtkWidget* m_pNotebook;
|
GtkWidget* m_pNotebook;
|
||||||
GtkWidget* m_pWidget;
|
GtkWidget* m_pWidget;
|
||||||
GtkWidget* m_pTree;
|
GtkWidget* m_pTree;
|
||||||
GtkCTreeNode* m_hWorld; //leo: not used keeping because of the win32 version
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GroupDlg *g_pGroupDlg;
|
extern GroupDlg *g_pGroupDlg;
|
||||||
|
|
|
@ -1249,7 +1249,7 @@ void DoEntityList(){
|
||||||
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
|
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
|
||||||
g_signal_connect( G_OBJECT( button ), "clicked",
|
g_signal_connect( G_OBJECT( button ), "clicked",
|
||||||
G_CALLBACK( entitylist_select ), dialog );
|
G_CALLBACK( entitylist_select ), dialog );
|
||||||
|
gtk_widget_set_size_request( button, 60, -1 );
|
||||||
gtk_widget_show( button );
|
gtk_widget_show( button );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -739,7 +739,7 @@ GtkWidget* create_sub_menu_with_mnemonic( GtkWidget *bar, const gchar *mnemonic
|
||||||
|
|
||||||
extern void AddMenuItem( GtkWidget* menu, unsigned int id );
|
extern void AddMenuItem( GtkWidget* menu, unsigned int id );
|
||||||
|
|
||||||
GtkWidget* create_menu_item_with_mnemonic( GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id ){
|
GtkWidget* create_menu_item_with_mnemonic( GtkWidget *menu, const gchar *mnemonic, GCallback func, int id ){
|
||||||
GtkWidget *item;
|
GtkWidget *item;
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_mnemonic( mnemonic );
|
item = gtk_menu_item_new_with_mnemonic( mnemonic );
|
||||||
|
@ -1696,11 +1696,17 @@ void CheckMenuSplitting( GtkWidget *&menu ){
|
||||||
// move the last 2 items to a submenu (3 because of win32)
|
// move the last 2 items to a submenu (3 because of win32)
|
||||||
for ( int i = 0; i < 3; i++ )
|
for ( int i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
item = GTK_WIDGET( g_list_last( gtk_container_get_children( GTK_CONTAINER( menu ) ) )->data );
|
GList *children = gtk_container_get_children( GTK_CONTAINER( menu ) ) ;
|
||||||
|
if( !children ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
item = GTK_WIDGET( g_list_last( children )->data );
|
||||||
g_object_ref( item );
|
g_object_ref( item );
|
||||||
gtk_container_remove( GTK_CONTAINER( menu ), item );
|
gtk_container_remove( GTK_CONTAINER( menu ), item );
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( menu2 ), item );
|
gtk_menu_shell_append( GTK_MENU_SHELL( menu2 ), item );
|
||||||
g_object_unref( item );
|
g_object_unref( item );
|
||||||
|
|
||||||
|
g_list_free( children );
|
||||||
}
|
}
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_label( "--------" );
|
item = gtk_menu_item_new_with_label( "--------" );
|
||||||
|
|
|
@ -42,7 +42,7 @@ inline void get_window_pos( GtkWidget *wnd, int* x, int* y ){
|
||||||
#else
|
#else
|
||||||
|
|
||||||
inline void get_window_pos( GtkWidget *wnd, int* x, int* y ){
|
inline void get_window_pos( GtkWidget *wnd, int* x, int* y ){
|
||||||
gdk_window_get_root_origin( wnd->window, x, y );
|
gdk_window_get_root_origin( gtk_widget_get_window( wnd ), x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,9 +66,9 @@ GtkWidget* new_plugin_image_icon( const char* filename );
|
||||||
GtkWidget* menu_separator( GtkWidget *menu );
|
GtkWidget* menu_separator( GtkWidget *menu );
|
||||||
GtkWidget* menu_tearoff( GtkWidget *menu );
|
GtkWidget* menu_tearoff( GtkWidget *menu );
|
||||||
GtkWidget* create_sub_menu_with_mnemonic( GtkWidget *bar, const gchar *mnemonic );
|
GtkWidget* create_sub_menu_with_mnemonic( GtkWidget *bar, const gchar *mnemonic );
|
||||||
GtkWidget* create_menu_item_with_mnemonic( GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id );
|
GtkWidget* create_menu_item_with_mnemonic( GtkWidget *menu, const gchar *mnemonic, GCallback func, int id );
|
||||||
GtkWidget* create_check_menu_item_with_mnemonic( GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean active );
|
GtkWidget* create_check_menu_item_with_mnemonic( GtkWidget *menu, const gchar *mnemonic, GCallback func, int id, gboolean active );
|
||||||
GtkWidget* create_radio_menu_item_with_mnemonic( GtkWidget *menu, GtkWidget *last, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean state );
|
GtkWidget* create_radio_menu_item_with_mnemonic( GtkWidget *menu, GtkWidget *last, const gchar *mnemonic, GCallback func, int id, gboolean state );
|
||||||
GtkWidget* create_menu_in_menu_with_mnemonic( GtkWidget *menu, const gchar *mnemonic );
|
GtkWidget* create_menu_in_menu_with_mnemonic( GtkWidget *menu, const gchar *mnemonic );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4033,18 +4033,23 @@ void MainFrame::DoWatchBSP(){
|
||||||
|
|
||||||
void MainFrame::CleanPlugInMenu(){
|
void MainFrame::CleanPlugInMenu(){
|
||||||
GtkWidget *menu, *sep;
|
GtkWidget *menu, *sep;
|
||||||
GList *lst;
|
GList *children, *seplst, *lst;
|
||||||
|
|
||||||
// delete everything after the separator
|
// delete everything after the separator
|
||||||
menu = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_plugin" ) );
|
menu = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_plugin" ) );
|
||||||
sep = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_plugin_separator" ) );
|
sep = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_plugin_separator" ) );
|
||||||
m_nNextPlugInID = ID_PLUGIN_START;
|
m_nNextPlugInID = ID_PLUGIN_START;
|
||||||
|
|
||||||
lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( menu ) ), sep );
|
children = gtk_container_get_children( GTK_CONTAINER( menu ) );
|
||||||
while ( lst->next )
|
if( children ) {
|
||||||
|
seplst = g_list_find( children, sep );
|
||||||
|
if( seplst ) {
|
||||||
|
for ( lst = g_list_next( seplst ); lst != NULL; lst = g_list_next( lst ) )
|
||||||
{
|
{
|
||||||
gtk_container_remove( GTK_CONTAINER( menu ), GTK_WIDGET( lst->next->data ) );
|
gtk_container_remove( GTK_CONTAINER( menu ), GTK_WIDGET( lst->data ) );
|
||||||
lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( menu ) ), sep );
|
}
|
||||||
|
}
|
||||||
|
g_list_free( children );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4102,11 +4107,13 @@ inline GtkToolbarChildType gtktoolbarchildtype_for_toolbarbuttontype( IToolbarBu
|
||||||
return (GtkToolbarChildType)0;
|
return (GtkToolbarChildType)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void toolbar_insert( GtkWidget *toolbar, const char* image, const char* text, const char* tooltip, IToolbarButton::EType type, GtkSignalFunc handler, gpointer data ){
|
void toolbar_insert( GtkWidget *toolbar, const char* image, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback callback, gpointer data ){
|
||||||
GtkWidget *pixmap;
|
GtkWidget *w, *pixmap;
|
||||||
|
GdkPixmap *gdkpixmap;
|
||||||
|
GdkBitmap *mask;
|
||||||
|
|
||||||
pixmap = new_plugin_image_icon( image );
|
pixmap = new_plugin_image_icon( image );
|
||||||
gtk_toolbar_append_element( GTK_TOOLBAR( toolbar ), gtktoolbarchildtype_for_toolbarbuttontype( type ), NULL, text, tooltip, "", GTK_WIDGET( pixmap ), handler, data );
|
w = gtk_toolbar_append_element( GTK_TOOLBAR( toolbar ), gtktoolbarchildtype_for_toolbarbuttontype( type ), NULL, text, tooltip, "", GTK_WIDGET( pixmap ), callback, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalToolbarButton( GtkWidget *widget, gpointer data ){
|
void SignalToolbarButton( GtkWidget *widget, gpointer data ){
|
||||||
|
|
|
@ -1370,7 +1370,7 @@ static void MRU_SetText( int index, const char *filename ){
|
||||||
mnemonic[2] = '-';
|
mnemonic[2] = '-';
|
||||||
mnemonic[3] = ' ';
|
mnemonic[3] = ' ';
|
||||||
buffer_write_escaped_mnemonic( mnemonic + 4, filename );
|
buffer_write_escaped_mnemonic( mnemonic + 4, filename );
|
||||||
gtk_label_set_text_with_mnemonic( GTK_LABEL( GTK_BIN( MRU_items[index] )->child ), mnemonic );
|
gtk_menu_item_set_label( GTK_MENU_ITEM( MRU_items[index] ), mnemonic );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MRU_Load(){
|
void MRU_Load(){
|
||||||
|
@ -1447,7 +1447,7 @@ void MRU_Activate( int index ){
|
||||||
MRU_SetText( i, MRU_GetText( i + 1 ) );
|
MRU_SetText( i, MRU_GetText( i + 1 ) );
|
||||||
|
|
||||||
if ( MRU_used == 0 ) {
|
if ( MRU_used == 0 ) {
|
||||||
gtk_label_set_text( GTK_LABEL( GTK_BIN( MRU_items[0] )->child ), _( "Recent Files" ) );
|
gtk_menu_item_set_label( GTK_MENU_ITEM( MRU_items[0] ), _( "Recent Files" ) );
|
||||||
gtk_widget_set_sensitive( MRU_items[0], FALSE );
|
gtk_widget_set_sensitive( MRU_items[0], FALSE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1541,17 +1541,23 @@ char *bsp_commands[256];
|
||||||
void FillBSPMenu(){
|
void FillBSPMenu(){
|
||||||
GtkWidget *item, *menu; // menu points to a GtkMenu (not an item)
|
GtkWidget *item, *menu; // menu points to a GtkMenu (not an item)
|
||||||
epair_t *ep;
|
epair_t *ep;
|
||||||
GList *lst;
|
GList *children, *lst;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
menu = GTK_WIDGET( g_object_get_data( G_OBJECT( g_qeglobals_gui.d_main_window ), "menu_bsp" ) );
|
menu = GTK_WIDGET( g_object_get_data( G_OBJECT( g_qeglobals_gui.d_main_window ), "menu_bsp" ) );
|
||||||
|
|
||||||
while ( ( lst = gtk_container_children( GTK_CONTAINER( menu ) ) ) != NULL )
|
children = gtk_container_get_children( GTK_CONTAINER( menu ) );
|
||||||
gtk_container_remove( GTK_CONTAINER( menu ), GTK_WIDGET( lst->data ) );
|
if( children ) {
|
||||||
|
for ( lst = children; lst != NULL; lst = g_list_next( lst ) )
|
||||||
|
{
|
||||||
|
gtk_container_remove( GTK_CONTAINER( menu ), GTK_WIDGET( lst->data ) );
|
||||||
|
}
|
||||||
|
g_list_free( children );
|
||||||
|
}
|
||||||
|
|
||||||
if ( g_PrefsDlg.m_bDetachableMenus ) {
|
if ( g_PrefsDlg.m_bDetachableMenus ) {
|
||||||
item = gtk_tearoff_menu_item_new();
|
item = gtk_tearoff_menu_item_new();
|
||||||
gtk_menu_append( GTK_MENU( menu ), item );
|
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
|
||||||
gtk_widget_set_sensitive( item, TRUE );
|
gtk_widget_set_sensitive( item, TRUE );
|
||||||
gtk_widget_show( item );
|
gtk_widget_show( item );
|
||||||
}
|
}
|
||||||
|
@ -1568,9 +1574,12 @@ void FillBSPMenu(){
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
// first token is menu name
|
// first token is menu name
|
||||||
item = gtk_menu_get_attach_widget( GTK_MENU( menu ) );
|
children = gtk_container_get_children( GTK_CONTAINER( menu ) );
|
||||||
gtk_label_set_text( GTK_LABEL( GTK_BIN( item )->child ), token );
|
if( children ) {
|
||||||
|
if( g_list_first( children ) )
|
||||||
|
gtk_label_set_text( GTK_LABEL( g_list_first( children )->data ), token );
|
||||||
|
g_list_free( children );
|
||||||
|
}
|
||||||
token = strtok( NULL, ",;" );
|
token = strtok( NULL, ",;" );
|
||||||
while ( token != NULL )
|
while ( token != NULL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -547,7 +547,7 @@ void ClearGSList( GSList* lst ){
|
||||||
|
|
||||||
void FillTextureMenu( GSList** pArray ){
|
void FillTextureMenu( GSList** pArray ){
|
||||||
GtkWidget *menu, *sep, *item; // point to the Textures GtkMenu and to the last separator
|
GtkWidget *menu, *sep, *item; // point to the Textures GtkMenu and to the last separator
|
||||||
GList *lst;
|
GList *children, *seplst, *lst;
|
||||||
GSList *texdirs = NULL;
|
GSList *texdirs = NULL;
|
||||||
GSList *texdirs_tmp = NULL;
|
GSList *texdirs_tmp = NULL;
|
||||||
GSList *p;
|
GSList *p;
|
||||||
|
@ -556,13 +556,16 @@ void FillTextureMenu( GSList** pArray ){
|
||||||
// delete everything
|
// delete everything
|
||||||
menu = GTK_WIDGET( g_object_get_data( G_OBJECT( g_qeglobals_gui.d_main_window ), "menu_textures" ) );
|
menu = GTK_WIDGET( g_object_get_data( G_OBJECT( g_qeglobals_gui.d_main_window ), "menu_textures" ) );
|
||||||
sep = GTK_WIDGET( g_object_get_data( G_OBJECT( g_qeglobals_gui.d_main_window ), "menu_textures_separator" ) );
|
sep = GTK_WIDGET( g_object_get_data( G_OBJECT( g_qeglobals_gui.d_main_window ), "menu_textures_separator" ) );
|
||||||
lst = g_list_find( gtk_container_children( GTK_CONTAINER( menu ) ), sep );
|
children = gtk_container_get_children( GTK_CONTAINER( menu ) );
|
||||||
while ( lst->next )
|
if( children ) {
|
||||||
{
|
seplst = g_list_find( children, sep );
|
||||||
// these delete functions are recursive, it's gonna free all submenus
|
if( seplst ) {
|
||||||
gtk_widget_destroy( GTK_WIDGET( lst->next->data ) );
|
for ( lst = g_list_next( seplst ); lst != NULL; lst = g_list_next( lst ) )
|
||||||
// lst is no longer relevant, need to get it again
|
{
|
||||||
lst = g_list_find( gtk_container_children( GTK_CONTAINER( menu ) ), sep );
|
gtk_widget_destroy( GTK_WIDGET( lst->data ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_list_free( children );
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_nummenus = 0;
|
texture_nummenus = 0;
|
||||||
|
|
Loading…
Reference in a new issue