return image_new_missing();
}
-inline GtkToolbarChildType gtktoolbarchildtype_for_toolbarbuttontype( IToolbarButton::EType type ){
- switch ( type )
- {
- case IToolbarButton::eSpace:
- return GTK_TOOLBAR_CHILD_SPACE;
- case IToolbarButton::eButton:
- return GTK_TOOLBAR_CHILD_BUTTON;
- case IToolbarButton::eToggleButton:
- return GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
- case IToolbarButton::eRadioButton:
- return GTK_TOOLBAR_CHILD_RADIOBUTTON;
+void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){
+ if (type == IToolbarButton::eSpace) {
+ auto it = ui::ToolItem::from(gtk_separator_tool_item_new());
+ it.show();
+ toolbar.add(it);
+ return;
}
- ERROR_MESSAGE( "invalid toolbar button type" );
- return (GtkToolbarChildType)0;
-}
-
-void toolbar_insert( GtkToolbar *toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GtkSignalFunc handler, gpointer data ){
- GtkWidget* widget = gtk_toolbar_append_element( toolbar, gtktoolbarchildtype_for_toolbarbuttontype( type ), 0, text, tooltip, "", GTK_WIDGET( new_plugin_image( icon ) ), handler, data );
- if( type != IToolbarButton::eSpace ){
++ #define GARUX_DISABLE_SPACER_NOFOCUS
++ #ifndef GARUX_DISABLE_SPACER_NOFOCUS
++ else {
+ GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_FOCUS );
+ GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_DEFAULT );
+ }
++ #endif // GARUX_DISABLE_SPACER_NOFOCUS
++
+ if (type == IToolbarButton::eButton) {
+ auto button = ui::ToolButton::from(gtk_tool_button_new(new_plugin_image(icon), text));
+ gtk_widget_set_tooltip_text(button, tooltip);
+ gtk_widget_show_all(button);
+ button.connect("clicked", G_CALLBACK(handler), data);
+ toolbar.add(button);
+ return;
+ }
++
+ if (type == IToolbarButton::eToggleButton) {
+ auto button = ui::ToolButton::from(gtk_toggle_tool_button_new());
+ gtk_tool_button_set_icon_widget(button, new_plugin_image(icon));
+ gtk_tool_button_set_label(button, text);
+ gtk_widget_set_tooltip_text(button, tooltip);
+ gtk_widget_show_all(button);
+ button.connect("toggled", G_CALLBACK(handler), data);
+ toolbar.add(button);
+ return;
+ }
++
+ ERROR_MESSAGE( "invalid toolbar button type" );
}
-void ActivateToolbarButton( GtkWidget *widget, gpointer data ){
- const_cast<const IToolbarButton*>( reinterpret_cast<IToolbarButton*>( data ) )->activate();
+void ActivateToolbarButton( ui::ToolButton widget, gpointer data ){
+ (const_cast<const IToolbarButton *>( reinterpret_cast<IToolbarButton *>( data )))->activate();
}
-void PlugInToolbar_AddButton( GtkToolbar* toolbar, const IToolbarButton* button ){
- toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), GTK_SIGNAL_FUNC( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
+void PlugInToolbar_AddButton( ui::Toolbar toolbar, const IToolbarButton* button ){
+ toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), G_CALLBACK( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
}
-GtkToolbar* g_plugin_toolbar = 0;
+ui::Toolbar g_plugin_toolbar{ui::null};
void PluginToolbar_populate(){
class AddToolbarItemVisitor : public ToolbarModules::Visitor
// if we have a mod dir
if ( !string_equal( gamename, basegame ) ) {
// ~/.<gameprefix>/<fs_game>
- if ( userRoot && !g_disableHomePath ) {
- if ( userRoot && !string_equal( globalRoot, userRoot ) ) {
++ if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) {
StringOutputStream userGamePath( 256 );
userGamePath << userRoot << gamename << '/';
GlobalFileSystem().initDirectory( userGamePath.c_str() );
}
// ~/.<gameprefix>/<fs_main>
- if ( userRoot && !g_disableHomePath ) {
- if ( userRoot && !string_equal( globalRoot, userRoot ) ) {
++ if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) {
StringOutputStream userBasePath( 256 );
userBasePath << userRoot << basegame << '/';
GlobalFileSystem().initDirectory( userBasePath.c_str() );
}
}
}
- else if ( event->type == GDK_2BUTTON_PRESS ) {
+ else if ( event->type == GDK_2BUTTON_PRESS && event->button == 1 ) {
+ #define GARUX_DISABLE_2BUTTON
+ #ifndef GARUX_DISABLE_2BUTTON
+ CopiedString texName = textureBrowser->shader;
- const char* sh = texName.c_str();
+ const char* sh = textureBrowser->shader.c_str();
char* dir = strrchr( sh, '/' );
if( dir != NULL ){
*(dir + 1) = '\0';
}
}
}
+ #endif
}
- else if ( event->type == GDK_3BUTTON_PRESS ) {
+ else if ( event->type == GDK_2BUTTON_PRESS && event->button == 3 ) {
ScopeDisableScreenUpdates disableScreenUpdates( TextureBrowser_getComonShadersDir(), "Loading Textures" );
TextureBrowser_ShowDirectory( *textureBrowser, TextureBrowser_getComonShadersDir() );
TextureBrowser_queueDraw( *textureBrowser );