From 242b6e1e3d020e8d36325821e15984ae84c673b1 Mon Sep 17 00:00:00 2001 From: jdolan Date: Thu, 4 Jul 2013 22:40:41 -0400 Subject: [PATCH 1/6] #196 Workaround to get internal clipboard working on Mac. Even if retrieving the selection from the OS fails, if we still have something in the local clipboard buffer, use it. This at least restores the standard copy-paste workflow within the editor. @TTimo please review. --- radiant/mainframe.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 3d94b5d..77c2a45 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2110,12 +2110,13 @@ static void clipboard_clear( GtkClipboard *clipboard, gpointer user_data_or_owne } static void clipboard_received( GtkClipboard *clipboard, GtkSelectionData *data, gpointer user_data ){ - g_Clipboard.SetLength( 0 ); + //g_Clipboard.SetLength( 0 ); if ( data->length < 0 ) { Sys_FPrintf( SYS_ERR, "Error retrieving selection\n" ); } else if ( strcmp( gdk_atom_name( data->type ), clipboard_targets[0].target ) == 0 ) { + g_Clipboard.SetLength( 0 ); g_Clipboard.Write( data->data, data->length ); } From 5df79a9c6223b963dd36186627c6f74d428a01ba Mon Sep 17 00:00:00 2001 From: "Timothee \"TTimo\" Besset" Date: Fri, 5 Jul 2013 15:55:09 -0500 Subject: [PATCH 2/6] tweak the GL widget font (for windows mostly) --- .gitignore | 3 +++ libs/synapse/synapse.cpp | 3 +-- radiant/glwidget.cpp | 7 +------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6f35cf6..afed694 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /install/q3map2 /install/q3map2_urt /install/radiant.bin +/install/share /packs /site.sconf /.sconsign.dblite @@ -13,3 +14,5 @@ *.so .settings .DS_Store +*.obj +*.tlog diff --git a/libs/synapse/synapse.cpp b/libs/synapse/synapse.cpp index ceac6a6..74cc07f 100644 --- a/libs/synapse/synapse.cpp +++ b/libs/synapse/synapse.cpp @@ -789,8 +789,7 @@ void CSynapseClient::Shutdown(){ APIDescriptor_t *pAPI = *iAPI; if ( pAPI->mRefCount != 0 ) { Syn_Printf( "WARNING: ~CSynapseClient '%s' has non-zero ref count for interface '%s' '%s'\n", GetInfo(), pAPI->major_name, pAPI->minor_name ); - } - else{ + } else { delete pAPI; } *iAPI = NULL; diff --git a/radiant/glwidget.cpp b/radiant/glwidget.cpp index d8d5456..1aa9d1f 100644 --- a/radiant/glwidget.cpp +++ b/radiant/glwidget.cpp @@ -204,13 +204,8 @@ gboolean WINAPI gtk_glwidget_make_current( GtkWidget *widget ){ // Think about rewriting this font stuff to use OpenGL display lists and glBitmap(). // Bit maps together with display lists may offer a performance increase, but // they would not allow antialiased fonts. -#ifdef _WIN32 -static const char font_string[] = "Courier bold"; -static const int font_height = 9; -#else -static const char font_string[] = "Monospace"; +static const char font_string[] = "Monospace bold"; static const int font_height = 10; -#endif static int font_ascent = -1; static int font_descent = -1; static int y_offset_bitmap_render_pango_units = -1; From 1c1fa7173aa17f0c1600de3679ca72dacaec9341 Mon Sep 17 00:00:00 2001 From: "Timothee \"TTimo\" Besset" Date: Sat, 6 Jul 2013 16:03:25 -0500 Subject: [PATCH 3/6] cosmetic --- radiant/glwindow.cpp | 23 +------------ radiant/glwindow.h | 80 +++++++++++++++++-------------------------- radiant/groupdialog.h | 18 +++++----- radiant/texwindow.cpp | 13 ++----- 4 files changed, 44 insertions(+), 90 deletions(-) diff --git a/radiant/glwindow.cpp b/radiant/glwindow.cpp index 1c1883f..92ae7c8 100644 --- a/radiant/glwindow.cpp +++ b/radiant/glwindow.cpp @@ -172,21 +172,6 @@ static gint timer( gpointer data ){ return TRUE; } -//! GtkGLExt port. -/* - static void create_context (GtkWidget *widget, gpointer data) - { - if (g_qeglobals_gui.d_glBase == NULL) - g_qeglobals_gui.d_glBase = widget; - } - - static void destroy_context (GtkWidget *widget, gpointer data) - { - if (g_qeglobals_gui.d_glBase == widget) - g_qeglobals_gui.d_glBase = NULL; - } - */ - #if GTK_CHECK_VERSION( 1,3,0 ) static gint scroll_event( GtkWidget *widget, GdkEventScroll *event, @@ -204,7 +189,7 @@ static gint scroll_event( GtkWidget *widget, //#define DBG_GLWINDOW #endif -GLWindow::GLWindow ( bool zbuffer ){ +GLWindow::GLWindow( bool zbuffer ) { m_nTimer = 0; m_bMouseCapture = FALSE; m_pParent = NULL; @@ -216,12 +201,9 @@ GLWindow::GLWindow ( bool zbuffer ){ Sys_Printf( "GLWindow::GLWindow m_pWidget = %p\n", m_pWidget ); #endif -//! GtkGLExt port. -//#if defined (__linux__) || defined (__APPLE__) if ( g_qeglobals_gui.d_glBase == NULL ) { g_qeglobals_gui.d_glBase = m_pWidget; } -//#endif #if GTK_CHECK_VERSION( 1,3,0 ) gtk_widget_set_events( m_pWidget, GDK_DESTROY | GDK_EXPOSURE_MASK | @@ -238,9 +220,6 @@ GLWindow::GLWindow ( bool zbuffer ){ gtk_signal_connect( GTK_OBJECT( m_pWidget ), "button_press_event", GTK_SIGNAL_FUNC( button_press ), this ); gtk_signal_connect( GTK_OBJECT( m_pWidget ), "button_release_event",GTK_SIGNAL_FUNC( button_release ), this ); gtk_signal_connect( GTK_OBJECT( m_pWidget ), "size_allocate", GTK_SIGNAL_FUNC( resize ), this ); -//! GtkGLExt port. -// gtk_signal_connect (GTK_OBJECT (m_pWidget), "create_context", GTK_SIGNAL_FUNC (create_context), this); -// gtk_signal_connect (GTK_OBJECT (m_pWidget), "destroy_context", GTK_SIGNAL_FUNC (destroy_context), this); #if GTK_CHECK_VERSION( 1,3,0 ) gtk_signal_connect( GTK_OBJECT( m_pWidget ), "scroll_event", GTK_SIGNAL_FUNC( scroll_event ), this ); #endif diff --git a/radiant/glwindow.h b/radiant/glwindow.h index f9c373e..d5f6c73 100644 --- a/radiant/glwindow.h +++ b/radiant/glwindow.h @@ -31,72 +31,56 @@ #ifndef _GLWINDOW_H_ #define _GLWINDOW_H_ -class GLWindow -{ +class GLWindow { public: -GLWindow ( bool zbuffer ); -virtual ~GLWindow (); + GLWindow( bool zbuffer ); + virtual ~GLWindow (); -bool MakeCurrent(); -void SwapBuffers(); -void SetTimer( guint millisec ); -void KillTimer(); -bool HasTimer() -{ return m_nTimer != 0; } -void DestroyContext(); -void CreateContext(); + bool MakeCurrent(); + void SwapBuffers(); + void SetTimer( guint millisec ); + void KillTimer(); + bool HasTimer() { return m_nTimer != 0; } + void DestroyContext(); + void CreateContext(); -virtual void OnCreate() { } -virtual void OnExpose() { } + virtual void OnCreate() { } + virtual void OnExpose() { } -virtual void OnLButtonDown( guint32 flags, int x, int y ) { } -virtual void OnRButtonDown( guint32 flags, int x, int y ) { } -virtual void OnMButtonDown( guint32 flags, int x, int y ) { } -virtual void OnLButtonUp( guint32 flags, int pointx, int pointy ) { } -virtual void OnRButtonUp( guint32 flags, int pointx, int pointy ) { } -virtual void OnMButtonUp( guint32 flags, int pointx, int pointy ) { } -virtual void OnMouseMove( guint32 flags, int pointx, int pointy ) { } + virtual void OnLButtonDown( guint32 flags, int x, int y ) { } + virtual void OnRButtonDown( guint32 flags, int x, int y ) { } + virtual void OnMButtonDown( guint32 flags, int x, int y ) { } + virtual void OnLButtonUp( guint32 flags, int pointx, int pointy ) { } + virtual void OnRButtonUp( guint32 flags, int pointx, int pointy ) { } + virtual void OnMButtonUp( guint32 flags, int pointx, int pointy ) { } + virtual void OnMouseMove( guint32 flags, int pointx, int pointy ) { } + virtual void OnSize( int cx, int cy ) { } + virtual void OnTimer() { } -virtual void OnSize( int cx, int cy ) { } -virtual void OnTimer() { } + virtual void OnMouseWheel( bool bUp ) { } -virtual void OnMouseWheel( bool bUp ) { } + void RedrawWindow() { gtk_widget_queue_draw( m_pWidget ); } -void RedrawWindow(){ - gtk_widget_queue_draw( m_pWidget ); -} + void SetFocus() { /* gdk_window_raise (m_pWidget->window); */ } -void SetFocus(){ - /* gdk_window_raise (m_pWidget->window); */ -} + void SetCapture() { m_bMouseCapture = TRUE; } + void ReleaseCapture() { m_bMouseCapture = FALSE; } -void SetCapture(){ - m_bMouseCapture = TRUE; -} + bool HasCapture() { return m_bMouseCapture; } -void ReleaseCapture(){ - m_bMouseCapture = FALSE; -} - -bool HasCapture(){ - return m_bMouseCapture; -} - -GtkWidget* GetWidget(){ - return m_pWidget; -} + GtkWidget * GetWidget() { return m_pWidget; } // member variables public: -GtkWidget* m_pParent; // for floating windows only + GtkWidget* m_pParent; // for floating windows only protected: -bool m_bMouseCapture; -GtkWidget* m_pWidget; + bool m_bMouseCapture; + GtkWidget* m_pWidget; private: -guint m_nTimer; // only one timer supported + guint m_nTimer; // only one timer supported }; #endif //_GLWINDOW_H_ diff --git a/radiant/groupdialog.h b/radiant/groupdialog.h index c9947a6..2adb2a4 100644 --- a/radiant/groupdialog.h +++ b/radiant/groupdialog.h @@ -86,19 +86,17 @@ extern GtkWidget* EntWidgets[EntLast]; class GroupDlg { public: -GroupDlg (); -void Create(); + GroupDlg(); + void Create(); -void Show() -{ gtk_widget_show( m_pWidget ); }; -void Hide() -{ gtk_widget_hide( m_pWidget ); }; + void Show() { gtk_widget_show( m_pWidget ); } + void Hide() { gtk_widget_hide( m_pWidget ); } public: -GtkWidget* m_pNotebook; -GtkWidget* m_pWidget; -GtkWidget* m_pTree; -GtkCTreeNode* m_hWorld; //leo: not used keeping because of the win32 version + GtkWidget* m_pNotebook; + GtkWidget* m_pWidget; + GtkWidget* m_pTree; + GtkCTreeNode* m_hWorld; //leo: not used keeping because of the win32 version }; extern GroupDlg *g_pGroupDlg; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index d6409bd..0e0fa66 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -54,11 +54,6 @@ static unsigned tex_palette[256]; #define FONT_HEIGHT 10 -//int texture_mode = GL_NEAREST; -//int texture_mode = GL_NEAREST_MIPMAP_NEAREST; -//int texture_mode = GL_NEAREST_MIPMAP_LINEAR; -//int texture_mode = GL_LINEAR; -//int texture_mode = GL_LINEAR_MIPMAP_NEAREST; int texture_mode = GL_LINEAR_MIPMAP_LINEAR; int g_nTextureOffset = 0; @@ -124,8 +119,7 @@ int GetTextureExtensionCount(){ // hardcoded hack for png support if ( g_pGameDescription->mGameFile == "sof2.game" ) { return 3; - } - else{ + } else { return 2; } } @@ -1667,8 +1661,7 @@ void TexWnd::OnCreate(){ if ( g_PrefsDlg.m_bTextureScrollbar ) { gtk_widget_show( g_qeglobals_gui.d_texture_scroll ); - } - else{ + } else { gtk_widget_hide( g_qeglobals_gui.d_texture_scroll ); } m_bNeedRange = true; @@ -1695,7 +1688,7 @@ void TexWnd::OnSize( int cx, int cy ){ m_bNeedRange = true; } -void TexWnd::OnExpose(){ +void TexWnd::OnExpose() { int nOld = g_qeglobals.d_texturewin.m_nTotalHeight; if ( !MakeCurrent() ) { Sys_Printf( "ERROR: glXMakeCurrent failed..\n " ); From d7fde9f5da06dfe518a5ef2f0f292803ff9e4a16 Mon Sep 17 00:00:00 2001 From: "Timothee \"TTimo\" Besset" Date: Sat, 6 Jul 2013 16:48:47 -0500 Subject: [PATCH 4/6] Fix issue #192 - flip the notebook page when hiding the dialog, forces the texture window to redraw correctly on next show --- radiant/groupdialog.cpp | 122 +++++----------------------------------- radiant/mainframe.cpp | 7 --- radiant/patchdialog.cpp | 9 --- radiant/patchdialog.h | 4 -- radiant/texwindow.cpp | 4 +- 5 files changed, 16 insertions(+), 130 deletions(-) diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index 440a36f..c4b8dce 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -656,35 +656,36 @@ void SetInspectorMode( int iType ){ } } - switch ( iType ) - { + switch ( iType ) { case W_ENTITY: // entity is always first in the inspector gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), "Entities" ); - gtk_notebook_set_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 0 ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 0 ); break; case W_TEXTURE: g_pParentWnd->GetTexWnd()->FocusEdit(); gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), "Textures" ); if ( g_pParentWnd->FloatingGroupDialog() ) { - gtk_notebook_set_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 1 ); + // if the notebook page is already at 1, no expose event fires up on the embedded GLWindow, leading in the texture window not drawing + // I did witness an expose event on the notebook widget though, but for some reason it's not traveling down.. + // so when hiding the group dialog, we are setting the page to 0, the page switch does an expose and triggers drawing.. (see OnDialogKey) + gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 1 ); } break; case W_CONSOLE: gtk_window_set_title( GTK_WINDOW( g_qeglobals_gui.d_entity ), "Console" ); if ( g_pParentWnd->FloatingGroupDialog() ) { - gtk_notebook_set_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 2 ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 2 ); } break; case W_GROUP: if ( g_pParentWnd->FloatingGroupDialog() ) { - gtk_notebook_set_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 3 ); - } - else{ - gtk_notebook_set_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 1 ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 3 ); + } else { + gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 1 ); } break; @@ -1097,34 +1098,7 @@ static gint entityentry_keypress( GtkWidget* widget, GdkEventKey* event, gpointe return FALSE; } -/* - // add a new group, put all selected brushes into the group - static void groupdlg_add (GtkWidget *widget, gpointer data) - { - char* name = DoNameDlg ("New Group"); - if (name != NULL) - { - // create a new group node - GtkCTreeNode *item; - item = gtk_ctree_insert_node (GTK_CTREE (g_wndGroup.m_pTree), g_pGroupDlg->m_hWorld, NULL, &name, 0, - tree_pixmaps[IMG_GROUP], tree_masks[IMG_GROUP], - tree_pixmaps[IMG_GROUP], tree_masks[IMG_GROUP], FALSE, TRUE); - - // create a new group - group_t *g = Group_Alloc (name); - g->itemOwner = item; - g->next = g_pGroups; - g_pGroups = g; - - // now add the selected brushes - // NOTE: it would be much faster to give the group_t for adding - // but Select_AddToGroup is the standard way for all other cases - Select_AddToGroup (name); - g_free (name); - } - } - */ static void switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data ){ char *text; gtk_label_get( GTK_LABEL( gtk_notebook_get_tab_label( notebook, gtk_notebook_get_nth_page( notebook, page_num ) ) ), &text ); @@ -1165,14 +1139,12 @@ static void switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint pag // NOTE: when a key is hit with group window focused, we catch in this handler but it gets propagated to mainframe too // therefore the message will be intercepted and used as a ID_SELECTION_DESELECT static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){ -#ifdef DBG_PI - Sys_Printf( "OnDialogKey\n" ); -#endif if ( ( event->keyval == GDK_Escape ) && ( g_pParentWnd->CurrentStyle() != MainFrame::eFloating ) ) { // toggle off the group view (whatever part of it is currently displayed) // this used to be done with a g_pParentWnd->OnViewEntity(); but it had bad consequences - // http://fenris.lokigames.com/show_bug.cgi?id=2773 - widget_delete_hide( g_qeglobals_gui.d_entity ); + gtk_widget_hide( widget ); + // set the group notebook page back to 0, so that when we recall the texture view there is an expose event coming up + gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 0 ); return TRUE; } return FALSE; @@ -1205,6 +1177,7 @@ void GroupDlg::Create(){ gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event", GTK_SIGNAL_FUNC( widget_delete_hide ), NULL ); // catch 'Esc' gtk_signal_connect( GTK_OBJECT( dlg ), "key_press_event", GTK_SIGNAL_FUNC( OnDialogKey ), NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); g_qeglobals_gui.d_entity = dlg; @@ -1316,33 +1289,21 @@ void GroupDlg::Create(){ GtkWidget *check = gtk_check_button_new_with_label( _( "!Easy" ) ); gtk_widget_show( check ); gtk_signal_connect( GTK_OBJECT( check ), "toggled", GTK_SIGNAL_FUNC( entity_check ), NULL ); -/* gtk_table_attach (GTK_TABLE (table), check, 2, 3, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/ EntWidgets[EntCheck17] = check; check = gtk_check_button_new_with_label( _( "!Medium" ) ); gtk_widget_show( check ); gtk_signal_connect( GTK_OBJECT( check ), "toggled", GTK_SIGNAL_FUNC( entity_check ), NULL ); -/* gtk_table_attach (GTK_TABLE (table), check, 2, 3, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/ EntWidgets[EntCheck18] = check; check = gtk_check_button_new_with_label( _( "!Hard" ) ); gtk_widget_show( check ); gtk_signal_connect( GTK_OBJECT( check ), "toggled", GTK_SIGNAL_FUNC( entity_check ), NULL ); -/* gtk_table_attach (GTK_TABLE (table), check, 2, 3, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/ EntWidgets[EntCheck19] = check; check = gtk_check_button_new_with_label( _( "!DeathMatch" ) ); gtk_widget_show( check ); gtk_signal_connect( GTK_OBJECT( check ), "toggled", GTK_SIGNAL_FUNC( entity_check ), NULL ); -/* gtk_table_attach (GTK_TABLE (table), check, 2, 3, 3, 4, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/ EntWidgets[EntCheck20] = check; } } @@ -1619,63 +1580,8 @@ void GroupDlg::Create(){ } } - - //++timo NOTE: this part for grouping code, don't remove! (we'll put it back in sometime soon) - - /* - vbox = gtk_vbox_new (FALSE, 5); - gtk_widget_show (vbox); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 3); - - scr = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scr); - gtk_box_pack_start (GTK_BOX (vbox), scr, TRUE, TRUE, 0); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - - ctree = gtk_ctree_new (1, 0); - gtk_widget_show (ctree); - gtk_container_add (GTK_CONTAINER (scr), ctree); - gtk_clist_column_titles_hide (GTK_CLIST (ctree)); - m_pTree = ctree; - - hbox = gtk_hbox_new (FALSE, 5); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); - - button = gtk_button_new_with_label (_("Add...")); - gtk_widget_show (button); - gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (groupdlg_add), NULL); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); - gtk_widget_set_usize (button, 60, -2); - - button = gtk_button_new_with_label (_("Edit...")); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); - gtk_widget_set_usize (button, 60, -2); - - button = gtk_button_new_with_label (_("Delete")); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); - gtk_widget_set_usize (button, 60, -2); - - label = gtk_label_new (_("Groups")); - gtk_widget_show (label); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label); - */ inspector_mode = W_ENTITY; - // gtk_window_set_title (GTK_WINDOW (dlg), _("Entities")); m_pWidget = dlg; - /* - load_pixmap ("grouptree1.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[0], &tree_masks[0]); - load_pixmap ("grouptree2.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[1], &tree_masks[1]); - load_pixmap ("grouptree3.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[2], &tree_masks[2]); - load_pixmap ("grouptree4.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[3], &tree_masks[3]); - load_pixmap ("grouptree5.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[4], &tree_masks[4]); - load_pixmap ("grouptree6.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[5], &tree_masks[5]); - load_pixmap ("grouptree7.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[6], &tree_masks[6]); - - Group_Init(); - */ g_signal_connect( G_OBJECT( notebook ), "switch_page", G_CALLBACK( switch_page ), dlg ); } } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 77c2a45..9c29501 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2809,8 +2809,6 @@ void MainFrame::Create(){ } } - // g_qeglobals_gui.d_edit = NULL; - { m_pTexWnd = new TexWnd(); GtkWidget* frame = create_framed_texwnd( m_pTexWnd ); @@ -2823,7 +2821,6 @@ void MainFrame::Create(){ } m_pTexWnd->m_pParent = g_pGroupDlg->m_pWidget; -// gtk_widget_realize (m_pTexWnd->GetWidget ()); m_pZWnd = create_floating_zwnd( this ); while ( gtk_events_pending() ) @@ -2857,7 +2854,6 @@ void MainFrame::Create(){ g_pParentWnd->OnEntitiesSetViewAs( 0 ); -// m_wndTextureBar.Create (vbox); create_main_statusbar( window, vbox ); LoadCommandMap(); @@ -2881,9 +2877,6 @@ void MainFrame::Create(){ gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), g_PrefsDlg.m_bTexturesShaderlistOnly ? TRUE : FALSE ); g_bIgnoreCommands--; -// if (g_PrefsDlg.m_bTextureBar) -// gtk_widget_show (m_wndTextureBar.m_pWidget); - SetActiveXY( m_pXYWnd ); s_idle_id = gtk_timeout_add( 25, mainframe_idle, this ); diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 727ed3c..357a581 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -75,9 +75,6 @@ static void OnSelchangeComboColRow( GtkWidget *widget, gpointer data ){ if ( !g_PatchDialog.m_bListenChanged ) { return; } -#ifdef DBG_PI - Sys_Printf( "OnSelchangeComboColRow\n" ); -#endif // retrieve the current m_nRow and m_nCol, other params are not relevant // (NOTE: UpdateData has a mechanism to avoid inifinite looping) g_PatchDialog.UpdateData( TRUE ); @@ -205,9 +202,6 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ adj->value = 0; -#ifdef DBG_PI - Sys_Printf( "Patch_SetTextureInfo: %g %g %g %g %g\n", td.shift[0], td.shift[1],td.scale[0],td.scale[1],td.rotate ); -#endif // will scale shift rotate the patch accordingly Patch_SetTextureInfo( &td ); // update the point-by-point view @@ -216,9 +210,6 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ } static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){ -#ifdef DBG_PI - Sys_Printf( "OnDialogKey\n" ); -#endif if ( event->keyval == GDK_Return ) { OnApply( NULL, NULL ); return TRUE; diff --git a/radiant/patchdialog.h b/radiant/patchdialog.h index ff908de..feb70f8 100644 --- a/radiant/patchdialog.h +++ b/radiant/patchdialog.h @@ -24,10 +24,6 @@ #include "dialog.h" -#ifdef _DEBUG -//#define DBG_PI -#endif - class PatchDialog : public Dialog { public: diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 0e0fa66..db284ed 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1778,9 +1778,9 @@ void TexWnd::UpdatePrefs(){ RedrawWindow(); } -void TexWnd::FocusEdit(){ +void TexWnd::FocusEdit() { if ( GTK_WIDGET_VISIBLE( m_pFilter ) ) { - gtk_window_set_focus( GTK_WINDOW( g_pParentWnd->m_pWidget ), m_pFilter ); + gtk_window_set_focus( GTK_WINDOW( g_pParentWnd->m_pWidget ), m_pFilter ); } } From e82eb1e37e8778c7029546f45f21ca3ed74e9379 Mon Sep 17 00:00:00 2001 From: "Timothee \"TTimo\" Besset" Date: Sat, 6 Jul 2013 17:24:05 -0500 Subject: [PATCH 5/6] In addition to Esc key, the ViewEntityInfo and ViewTextures keys will now hide the floating dialog again --- radiant/groupdialog.cpp | 47 ++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index c4b8dce..c2b82d0 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -1138,16 +1138,43 @@ static void switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint pag // NOTE: when a key is hit with group window focused, we catch in this handler but it gets propagated to mainframe too // therefore the message will be intercepted and used as a ID_SELECTION_DESELECT -static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){ - if ( ( event->keyval == GDK_Escape ) && ( g_pParentWnd->CurrentStyle() != MainFrame::eFloating ) ) { - // toggle off the group view (whatever part of it is currently displayed) - // this used to be done with a g_pParentWnd->OnViewEntity(); but it had bad consequences - gtk_widget_hide( widget ); - // set the group notebook page back to 0, so that when we recall the texture view there is an expose event coming up - gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 0 ); - return TRUE; - } - return FALSE; +static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ) { + // make the "ViewTextures" and "ViewEntityInfo" keys that normally bring this dialog up hide it as well - copypasta from mainframe_keypress + // NOTE: maybe we could also check the state of the notebook, see if those are actually displayed .. if they are not, then switch the notebook pages rather than hiding? + bool hide = false; + unsigned int code = gdk_keyval_to_upper( event->keyval ); + for ( int i = 0; i < g_nCommandCount; i++ ) { + if ( g_Commands[i].m_nKey == code ) { // find a match? + // check modifiers + unsigned int nState = 0; + if ( Sys_AltDown() ) { + nState |= RAD_ALT; + } + if ( ( event->state & GDK_CONTROL_MASK ) != 0 ) { + nState |= RAD_CONTROL; + } + if ( ( event->state & GDK_SHIFT_MASK ) != 0 ) { + nState |= RAD_SHIFT; + } + if ( ( g_Commands[i].m_nModifiers & 0x7 ) == nState ) { + Sys_Printf( "Floating group dialog: %s\n", g_Commands[i].m_strCommand ); + if ( g_Commands[i].m_nCommand == ID_VIEW_TEXTURE || g_Commands[i].m_nCommand == ID_VIEW_ENTITY ) { + hide = true; + } + break; + } + } + } + + if ( g_pParentWnd->CurrentStyle() != MainFrame::eFloating && ( hide || event->keyval == GDK_Escape ) ) { + // toggle off the group view (whatever part of it is currently displayed) + // this used to be done with a g_pParentWnd->OnViewEntity(); but it had bad consequences + gtk_widget_hide( widget ); + // set the group notebook page back to 0, so that when we recall the texture view there is an expose event coming up + gtk_notebook_set_current_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), 0 ); + return TRUE; + } + return FALSE; } GroupDlg::GroupDlg (){ From 6326d841955acf122c283d485b5cc5e69310d61e Mon Sep 17 00:00:00 2001 From: "Timothee \"TTimo\" Besset" Date: Sat, 6 Jul 2013 18:38:39 -0500 Subject: [PATCH 6/6] bump the number of texture directories, 128 -> 1024. issue #186 --- radiant/qe3.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/radiant/qe3.h b/radiant/qe3.h index 101dc62..61c0096 100644 --- a/radiant/qe3.h +++ b/radiant/qe3.h @@ -688,8 +688,7 @@ extern qboolean g_bShowAllShaders; // // texwindow.cpp // -//++timo TODO: we can probably raise the MAX_TEXTUREDIRS limit? -#define MAX_TEXTUREDIRS 256 +#define MAX_TEXTUREDIRS 1024 extern CPtrArray g_lstSkinCache; qtexture_t *QERApp_LoadTextureRGBA( unsigned char* pPixels, int nWidth, int nHeight );