toolbar.add(button);
}
+ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon ){
+ auto button = ui::ToolButton::from(gtk_tool_button_new(new_local_image(icon), nullptr));
+ toolbar_append(toolbar, button, description);
+ return button;
+}
+
ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback<void()>& callback ){
auto button = ui::ToolButton::from(gtk_tool_button_new(new_local_image(icon), nullptr));
button_connect_callback(button, callback);
class Command;
class Toggle;
+ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon );
ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback<void()>& callback );
ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Command& command );
ui::ToggleToolButton toolbar_append_toggle_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback<void()>& callback );
#include "debugging/debugging.h"
#include "property.h"
+inline bool widget_is_visible( GtkWidget* widget ){
+ return GTK_WIDGET_VISIBLE( widget ) != FALSE;
+}
+
+inline void widget_set_visible( GtkWidget* widget, bool show ){
+ if ( show ) {
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( widget ), "glwidget" ) );
+ if ( glwidget ){
+ //if ( widget_is_visible( glwidget ) )
+ //globalOutputStream() << "glwidget have been already visible :0\n"; /* is not hidden aswell, according to this */
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
+ gtk_widget_show( widget );
+ }
+ else
+ {
+ gtk_widget_hide( widget );
+ }
+}
+
class ToggleItem {
Callback<void(const Callback<void(bool)> &)> m_exportCallback;
typedef std::list<Callback<void(bool)>> ImportCallbacks;
inline void CHECK_RESTORE( ui::Widget w ){
if ( gpointer_to_int( g_object_get_data( G_OBJECT( w ), "was_mapped" ) ) != 0 ) {
w.show();
+ /* workaround for gtk 2.24 issue: not displayed glwidget after min/restore */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( w ), "glwidget" ) );
+ if ( glwidget ){
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
}
}
connect_floating_window_destroy_present( window, parent );
g_object_set_data( G_OBJECT( window ), "floating_handler", gint_to_pointer( connect_floating( parent, window ) ) );
window.connect( "destroy", G_CALLBACK( destroy_disconnect_floating ), parent );
+/*
+ //gtk_window_set_type_hint (window,GDK_WINDOW_TYPE_HINT_UTILITY);
+ //gtk_window_set_type_hint (window,GDK_WINDOW_TYPE_HINT_DIALOG);
+ gtk_window_set_keep_above ( window, TRUE );
+ GtkWidget* widget = GTK_WIDGET( window );
+ gtk_widget_realize ( widget );
+ GdkWindow* gdk_window = gtk_widget_get_window( widget );
+ //gdk_window_set_decorations ( gdk_window, (GdkWMDecoration)(GDK_DECOR_BORDER|GDK_DECOR_RESIZEH|GDK_DECOR_TITLE|GDK_DECOR_MENU|GDK_DECOR_MINIMIZE|GDK_DECOR_MAXIMIZE) );
+ //gdk_window_set_functions ( gdk_window, (GdkWMFunction)( GDK_FUNC_RESIZE|GDK_FUNC_MOVE|GDK_FUNC_MINIMIZE|GDK_FUNC_MAXIMIZE|GDK_FUNC_CLOSE ) );
+ //gdk_window_set_decorations ( gdk_window, (GdkWMDecoration)( GDK_DECOR_ALL ) );
+ //gdk_window_set_functions ( gdk_window, (GdkWMFunction)( GDK_FUNC_ALL ) );
+ //gdk_window_set_type_hint ( gdk_window, GDK_WINDOW_TYPE_HINT_DIALOG );
+ //gdk_window_set_type_hint ( gdk_window, GDK_WINDOW_TYPE_HINT_UTILITY );
+ //gdk_window_set_type_hint ( gdk_window, GDK_WINDOW_TYPE_HINT_NORMAL );
+ gdk_window_set_skip_taskbar_hint ( gdk_window, TRUE );
+ gdk_window_set_skip_pager_hint ( gdk_window, TRUE );
+*/
}
return window;
void Show(){
// workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
m_position_tracker.sync( m_window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( m_window ), "glwidget" ) );
+ if ( glwidget ){
+ //if ( widget_is_visible( glwidget ) )
+ //globalOutputStream() << "glwidget have been already visible :0\n"; /* is not hidden aswell, according to this */
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
m_window.show();
}
void Hide(){
#include "gtkutil/dialog.h"
#include "gtkutil/filechooser.h"
#include "gtkutil/menu.h"
-#include "gtkutil/toolbar.h"
#include "commands.h"
#define INCLUDED_GTKMISC_H
#include <uilib/uilib.h>
+#include "gtkutil/toolbar.h"
void command_connect_accelerator( const char* commandName );
void command_disconnect_accelerator( const char* commandName );
window.add(frame);
}
CamWnd_setParent( *m_pCamWnd, window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", CamWnd_getWidget( *m_pCamWnd ) );
g_floating_windows.push_back( window );
}
window.add(frame);
}
XY_Top_Shown_Construct( window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", m_pXYWnd->GetWidget() );
g_floating_windows.push_back( window );
}
}
XZ_Front_Shown_Construct( window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", m_pXZWnd->GetWidget() );
g_floating_windows.push_back( window );
}
}
YZ_Side_Shown_Construct( window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", m_pYZWnd->GetWidget() );
g_floating_windows.push_back( window );
}
{
auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
+
}
GroupDialog_show();
{
auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
}
}
void realise(){
m_realiseCallbacks();
/* texturebrowser tree update on vfs restart */
- TextureBrowser_constructTreeStore();
+// TextureBrowser_constructTreeStore();
}
void unrealise(){
return textures_menu_item;
}
+void Popup_View_Menu( GtkWidget *widget, GtkMenu *menu ){
+ gtk_menu_popup( menu, NULL, NULL, NULL, NULL, 1, gtk_get_current_event_time() );
+}
+
ui::MenuItem TextureBrowser_constructToolsMenu( ui::Menu menu ){
ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_Tools" ));
table.attach(vbox, {0, 1, 1, 3}, {GTK_FILL, GTK_FILL});
vbox.show();
- ui::Widget menu_bar{ui::null};
+ // ui::Widget menu_bar{ui::null};
+ auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
{ // menu bar
- menu_bar = ui::Widget::from(gtk_menu_bar_new());
+ // menu_bar = ui::Widget::from(gtk_menu_bar_new());
auto menu_view = ui::Menu(ui::New);
- auto view_item = TextureBrowser_constructViewMenu( menu_view );
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
- gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
+ // auto view_item = TextureBrowser_constructViewMenu( menu_view );
+ TextureBrowser_constructViewMenu( menu_view );
+ // gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
+ // gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
+ //gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( toolbar ), 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0 );
+ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( toolbar ), FALSE, FALSE, 0 );
+
+ //view menu button
+ {
+ auto button = toolbar_append_button( toolbar, "View", "texbro_view.png" );
+ button.dimensions( 22, 22 );
+ button.connect( "clicked", G_CALLBACK( Popup_View_Menu ), menu_view );
+ }
+ {
+ auto button = toolbar_append_button( toolbar, "Find / Replace...", "texbro_gtk-find-and-replace.png", "FindReplaceTextures" );
+ button.dimensions( 22, 22 );
+ }
+ {
+ auto button = toolbar_append_button( toolbar, "Flush & Reload Shaders", "texbro_refresh.png", "RefreshShaders" );
+ button.dimensions( 22, 22 );
+ }
+ toolbar.show();
+
+/*
auto menu_tools = ui::Menu(ui::New);
auto tools_item = TextureBrowser_constructToolsMenu( menu_tools );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools );
gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item );
-
- table.attach(menu_bar, {0, 3, 0, 1}, {GTK_FILL, GTK_SHRINK});
- menu_bar.show();
+*/
+ // table.attach(menu_bar, {0, 3, 0, 1}, {GTK_FILL, GTK_SHRINK});
+ // menu_bar.show();
}
{ // Texture TreeView
g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow(ui::New);
}
{ // tag menu bar
auto menu_tags = ui::Menu(ui::New);
- auto tags_item = TextureBrowser_constructTagsMenu( menu_tags );
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags );
- gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item );
+ // auto tags_item = TextureBrowser_constructTagsMenu( menu_tags );
+ TextureBrowser_constructTagsMenu( menu_tags );
+ // gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags );
+ // gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item );
+
+ auto button = toolbar_append_button( toolbar, "Tags", "texbro_tags.png" );
+ button.dimensions( 22, 22 );
+ button.connect( "clicked", G_CALLBACK( Popup_View_Menu ), menu_tags );
}
{ // Tag TreeView
g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow(ui::New);
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
GlobalShaderSystem().refresh();
+ /* texturebrowser tree update on vfs restart */
+ TextureBrowser_constructTreeStore();
UpdateAllWindows();
TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName );
else{
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
GlobalShaderSystem().refresh();
+ /* texturebrowser tree update on vfs restart */
+ TextureBrowser_constructTreeStore();
UpdateAllWindows();
}
}
Textures_setModeChangedNotify( Callback<void()>() );
}
+
+ui::Widget TextureBrowser_getGLWidget(){
+ return GlobalTextureBrowser().m_gl_widget;
+}
void TextureBrowser_RefreshShaders();
+ui::Widget TextureBrowser_getGLWidget();
+
#endif