}
// plugin name
-char* PLUGIN_NAME = "bobToolz";
+const char* PLUGIN_NAME = "bobToolz";
// commands in the menu
-static 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,Split patches cols,Split patches rows,Turn edge";
-
-// globals
-GtkWidget *g_pRadiantWnd = NULL;
+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,Split patches cols,Split patches rows,Turn edge";
- // globals
- ui::Window g_pRadiantWnd{ui::null};
-
static const char *PLUGIN_ABOUT = "bobToolz for SDRadiant\n"
"by digibob (digibob@splashdamage.com)\n"
"http://www.splashdamage.com\n\n"
--- /dev/null
-
+ #if !defined(INCLUDED_BOBTOOLZGTK_H)
+ #define INCLUDED_BOBTOOLZGTK_H
+
-extern GtkWidget *g_pRadiantWnd;
++#include <uilib/uilib.h>
++
++extern ui::Widget g_pRadiantWnd;
+
+ #endif
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ auto window = ui::Window( ui::window_type::TOP );
+ gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) );
- gtk_window_set_modal( GTK_WINDOW( window ), TRUE );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
- gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
+ gtk_window_set_title( window, lpCaption );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
ret = eIDNO;
}
- gtk_window_set_position( window, GTK_WIN_POS_CENTER );
+ gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER_ON_PARENT );
- gtk_widget_show( window );
+ window.show();
gtk_grab_add( window );
while ( loop )
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ auto window = ui::Window( ui::window_type::TOP );
+ gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
- gtk_window_set_title( GTK_WINDOW( window ), "Polygon Builder" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_window_set_title( window, "Polygon Builder" );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
// ---- /vbox ----
- gtk_window_set_position( window, GTK_WIN_POS_CENTER );
+ gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_modal( GTK_WINDOW( window ), TRUE );
- gtk_widget_show( window );
+ window.show();
gtk_grab_add( window );
bool dialogError = TRUE;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ auto window = ui::Window( ui::window_type::TOP );
+ gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) );
+ gtk_window_set_modal( GTK_WINDOW( window ), TRUE );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
- gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_window_set_title( window, "Texture Reset" );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
// ---- /vbox ----
- gtk_window_set_position( window, GTK_WIN_POS_CENTER );
+ gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER_ON_PARENT );
- gtk_widget_show( window );
+ window.show();
gtk_grab_add( window );
Update_TextureReseter();
#define GLADE_HOOKUP_OBJECT( component,widget,name ) \
g_object_set_data_full( G_OBJECT( component ), name, \
- gtk_widget_ref( widget ), (GDestroyNotify) gtk_widget_unref )
+ g_object_ref( (void *) widget ), (GDestroyNotify) g_object_unref )
#define GLADE_HOOKUP_OBJECT_NO_REF( component,widget,name ) \
- g_object_set_data( G_OBJECT( component ), name, widget )
+ g_object_set_data( G_OBJECT( component ), name, (void *) widget )
// created by glade
-GtkWidget*
-create_w_plugplug2( void ){
- GtkWidget *w_plugplug2;
- GtkWidget *vbox1;
- GtkWidget *hbox2;
- GtkWidget *vbox4;
- GtkWidget *r_collapse;
+ui::Widget create_w_plugplug2( void ){
GSList *r_collapse_group = NULL;
- GtkWidget *r_collapsebymaterial;
- GtkWidget *r_nocollapse;
- GtkWidget *vbox3;
- GtkWidget *b_export;
- GtkWidget *b_close;
- GtkWidget *vbox2;
- GtkWidget *label1;
- GtkWidget *scrolledwindow1;
- GtkWidget *t_materialist;
- GtkWidget *ed_materialname;
- GtkWidget *hbox1;
- GtkWidget *b_addmaterial;
- GtkWidget *b_removematerial;
- GtkWidget *t_exportmaterials;
- GtkWidget *t_limitmatnames;
- GtkWidget *t_objects;
- GtkTooltips *tooltips;
-
- tooltips = gtk_tooltips_new();
-
- w_plugplug2 = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+
+ auto w_plugplug2 = ui::Window( ui::window_type::TOP );
gtk_widget_set_name( w_plugplug2, "w_plugplug2" );
- gtk_window_set_title( GTK_WINDOW( w_plugplug2 ), "BrushExport-Plugin 3.0 by namespace" );
+ gtk_window_set_title( w_plugplug2, "BrushExport-Plugin 3.0 by namespace" );
- gtk_window_set_position( w_plugplug2, GTK_WIN_POS_CENTER );
+ gtk_window_set_position( GTK_WINDOW( w_plugplug2 ), GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_transient_for( GTK_WINDOW( w_plugplug2 ), GTK_WINDOW( g_pRadiantWnd ) );
- gtk_window_set_destroy_with_parent( GTK_WINDOW( w_plugplug2 ), TRUE );
+ gtk_window_set_destroy_with_parent( w_plugplug2, TRUE );
- vbox1 = gtk_vbox_new( FALSE, 0 );
+ auto vbox1 = ui::VBox( FALSE, 0 );
gtk_widget_set_name( vbox1, "vbox1" );
- gtk_widget_show( vbox1 );
- gtk_container_add( GTK_CONTAINER( w_plugplug2 ), vbox1 );
+ vbox1.show();
+ w_plugplug2.add(vbox1);
gtk_container_set_border_width( GTK_CONTAINER( vbox1 ), 5 );
- hbox2 = gtk_hbox_new( TRUE, 5 );
+ auto hbox2 = ui::HBox( TRUE, 5 );
gtk_widget_set_name( hbox2, "hbox2" );
- gtk_widget_show( hbox2 );
- gtk_box_pack_start( GTK_BOX( vbox1 ), hbox2, FALSE, FALSE, 0 );
+ hbox2.show();
+ vbox1.pack_start( hbox2, FALSE, FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 5 );
- vbox4 = gtk_vbox_new( TRUE, 0 );
+ auto vbox4 = ui::VBox( TRUE, 0 );
gtk_widget_set_name( vbox4, "vbox4" );
- gtk_widget_show( vbox4 );
- gtk_box_pack_start( GTK_BOX( hbox2 ), vbox4, TRUE, FALSE, 0 );
+ vbox4.show();
+ hbox2.pack_start( vbox4, TRUE, FALSE, 0 );
- r_collapse = gtk_radio_button_new_with_mnemonic( NULL, "Collapse mesh" );
+ auto r_collapse = ui::Widget::from(gtk_radio_button_new_with_mnemonic( NULL, "Collapse mesh" ));
gtk_widget_set_name( r_collapse, "r_collapse" );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_collapse, "Collapse all brushes into a single group", "Collapse all brushes into a single group" );
- gtk_widget_show( r_collapse );
- gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapse, FALSE, FALSE, 0 );
+ gtk_widget_set_tooltip_text(r_collapse, "Collapse all brushes into a single group");
+ r_collapse.show();
+ vbox4.pack_start( r_collapse, FALSE, FALSE, 0 );
gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapse ), r_collapse_group );
r_collapse_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( r_collapse ) );
void DestroyWindow( void );
bool IsWindowOpen( void );
-GtkWidget *g_pRadiantWnd = NULL;
++ui::Widget g_pRadiantWnd{ui::null};
+
namespace BrushExport
{
-GtkWindow* g_mainwnd;
+ui::Window g_mainwnd{ui::null};
const char* init( void* hApp, void* pMainWidget ){
- g_mainwnd = (GtkWindow*)pMainWidget;
- g_pRadiantWnd = (GtkWidget*)pMainWidget;
- ASSERT_NOTNULL( g_mainwnd );
+ g_mainwnd = ui::Window::from(pMainWidget);
++ g_pRadiantWnd = ui::Window::from(pMainWidget);
+ ASSERT_TRUE( g_mainwnd );
return "";
}
const char* getName(){
#if !defined( INCLUDED_BRUSH_EXPORT_H )
#define INCLUDED_BRUSH_EXPORT_H
-typedef struct _GtkWidget GtkWidget;
-extern GtkWidget *g_pRadiantWnd;
++#include <uilib/uilib.h>
++
++extern ui::Widget g_pRadiantWnd;
+
#endif
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
++#include <uilib/uilib.h>
++
#include "gensurf.h"
// Global plugin FuncTable
#include "iplugin.h"
const char* QERPlug_Init( void* hApp, void* pMainWidget ){
-- g_pRadiantWnd = (GtkWidget*)pMainWidget;
++ g_pRadiantWnd = ui::Window::from(pMainWidget);
return "GenSurf for Q3Radiant";
}
}
void DoAboutDlg(){
- GtkWidget *dlg, *hbox, *vbox, *button, *label;
int loop = 1, ret = IDCANCEL;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ auto dlg = ui::Window(ui::window_type::TOP);
+ gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
+ gtk_window_set_position( GTK_WINDOW( dlg ),GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_modal( GTK_WINDOW( dlg ), TRUE );
- gtk_window_set_title( GTK_WINDOW( dlg ), "About Portal Viewer" );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
- g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
- g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
-
- hbox = gtk_hbox_new( FALSE, 10 );
- gtk_widget_show( hbox );
- gtk_container_add( GTK_CONTAINER( dlg ), hbox );
- gtk_container_set_border_width( GTK_CONTAINER( hbox ), 10 );
-
- label = gtk_label_new( "Version 1.000\n\n"
- "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
- "Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
- "Built against NetRadiant " RADIANT_VERSION "\n"
- __DATE__
- );
- gtk_widget_show( label );
- gtk_box_pack_start( GTK_BOX( hbox ), label, TRUE, TRUE, 0 );
- gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
-
- vbox = gtk_vbox_new( FALSE, 0 );
- gtk_widget_show( vbox );
- gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 );
-
- button = gtk_button_new_with_label( "OK" );
- gtk_widget_show( button );
- gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_widget_set_usize( button, 60, -2 );
-
- gtk_grab_add( dlg );
- gtk_widget_show( dlg );
-
- while ( loop )
+ gtk_window_set_title(dlg, "About Portal Viewer");
+ dlg.connect("delete_event", G_CALLBACK(dialog_delete_callback), NULL);
+ dlg.connect("destroy", G_CALLBACK(gtk_widget_destroy), NULL);
+ g_object_set_data(G_OBJECT(dlg), "loop", &loop);
+ g_object_set_data(G_OBJECT(dlg), "ret", &ret);
+
+ auto hbox = ui::HBox(FALSE, 10);
+ hbox.show();
+ dlg.add(hbox);
+ gtk_container_set_border_width(GTK_CONTAINER(hbox), 10);
+
+ char const *label_text = "Version 1.000\n\n"
+ "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
+ "Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
+ "Built against NetRadiant " RADIANT_VERSION "\n"
+ __DATE__;
+ auto label = ui::Label(label_text);
+ label.show();
+ hbox.pack_start( label, TRUE, TRUE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+
+ auto vbox = ui::VBox(FALSE, 0);
+ vbox.show();
+ hbox.pack_start( vbox, FALSE, FALSE, 0);
+
+ auto button = ui::Button("OK");
+ button.show();
+ vbox.pack_start( button, FALSE, FALSE, 0);
+ button.connect("clicked", G_CALLBACK(dialog_button_callback), GINT_TO_POINTER(IDOK));
+ button.dimensions(60, -1);
+
+ gtk_grab_add(dlg);
+ dlg.show();
+
+ while (loop)
gtk_main_iteration();
- gtk_grab_remove( dlg );
- gtk_widget_destroy( dlg );
+ gtk_grab_remove(dlg);
+ dlg.destroy();
}
// Color selection dialog
static int DoColor( PackedColour *c ){
- GtkWidget* dlg;
- double clr[4];
+ GdkColor clr;
int loop = 1, ret = IDCANCEL;
- clr[0] = ( (double)GetRValue( *c ) ) / 255.0;
- clr[1] = ( (double)GetGValue( *c ) ) / 255.0;
- clr[2] = ( (double)GetBValue( *c ) ) / 255.0;
+ clr.red = (guint16) (GetRValue(*c) * (65535 / 255));
+ clr.blue = (guint16) (GetGValue(*c) * (65535 / 255));
+ clr.green = (guint16) (GetBValue(*c) * (65535 / 255));
+
+ auto dlg = ui::Widget::from(gtk_color_selection_dialog_new( "Choose Color" ));
+
- dlg = gtk_color_selection_dialog_new( "Choose Color" );
+ gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
+ gtk_window_set_position( GTK_WINDOW( dlg ),GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_modal( GTK_WINDOW( dlg ), TRUE );
- gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
- gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+ gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
+ dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ dlg.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
+
+ GtkWidget *ok_button, *cancel_button;
+ g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr);
+
+ ui::Widget::from(ok_button).connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ ui::Widget::from(cancel_button).connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
}
void DoConfigDialog(){
- GtkWidget *dlg, *hbox, *vbox, *vbox2, *button, *table, *frame;
- GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist, *menu, *item;
- GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck;
- GtkWidget *transslider, *translabel, *clipslider, *cliplabel;
- GtkWidget *show2check, *show3check, *portalcheck;
int loop = 1, ret = IDCANCEL;
- GtkObject *adj;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ auto dlg = ui::Window( ui::window_type::TOP );
++
+ gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
+ gtk_window_set_position( GTK_WINDOW( dlg ),GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_modal( GTK_WINDOW( dlg ), TRUE );
- gtk_window_set_title( GTK_WINDOW( dlg ), "Portal Viewer Configuration" );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
++
+ gtk_window_set_title( dlg, "Portal Viewer Configuration" );
+ dlg.connect( "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ dlg.connect( "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
return TRUE;
}
-static void file_sel_callback( GtkWidget *widget, gpointer data ){
- GtkWidget *parent;
- int *loop;
- char **filename;
-
- parent = gtk_widget_get_toplevel( widget );
- loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" );
- filename = (char**)g_object_get_data( G_OBJECT( parent ), "filename" );
-
- *loop = 0;
- if ( gpointer_to_int( data ) == IDOK ) {
- *filename = g_strdup( gtk_file_selection_get_filename( GTK_FILE_SELECTION( parent ) ) );
- }
-}
-
-static void change_clicked( GtkWidget *widget, gpointer data ){
- GtkWidget* file_sel;
+static void change_clicked(ui::Widget widget, gpointer data ){
char* filename = NULL;
- int loop = 1;
- file_sel = gtk_file_selection_new( "Locate portal (.prt) file" );
+ auto file_sel = ui::Widget::from(gtk_file_chooser_dialog_new ( "Locate portal (.prt) file", nullptr, GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ nullptr));
+
+ gtk_window_set_transient_for( GTK_WINDOW( file_sel ), GTK_WINDOW( g_pRadiantWnd ) );
+ gtk_window_set_position( GTK_WINDOW( file_sel ),GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_modal( GTK_WINDOW( file_sel ), TRUE );
- gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked",
- GTK_SIGNAL_FUNC( file_sel_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked",
- GTK_SIGNAL_FUNC( file_sel_callback ), GINT_TO_POINTER( IDCANCEL ) );
- gtk_signal_connect( GTK_OBJECT( file_sel ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION( file_sel ) );
-
- g_object_set_data( G_OBJECT( file_sel ), "loop", &loop );
- g_object_set_data( G_OBJECT( file_sel ), "filename", &filename );
- gtk_file_selection_set_filename( GTK_FILE_SELECTION( file_sel ), portals.fn );
+
- gtk_grab_add( file_sel );
- gtk_widget_show( file_sel );
-
- while ( loop )
- gtk_main_iteration();
+ gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file_sel), portals.fn );
- gtk_grab_remove( file_sel );
- gtk_widget_destroy( file_sel );
+ if (gtk_dialog_run (GTK_DIALOG (file_sel)) == GTK_RESPONSE_ACCEPT)
+ {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_sel));
+ }
+ ui::Widget(file_sel).destroy();
if ( filename != NULL ) {
strcpy( portals.fn, filename );
}
int DoLoadPortalFileDialog(){
- GtkWidget *dlg, *vbox, *hbox, *button, *entry, *check2d, *check3d;
int loop = 1, ret = IDCANCEL;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ auto dlg = ui::Window( ui::window_type::TOP );
++
+ gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
+ gtk_window_set_position( GTK_WINDOW( dlg ),GTK_WIN_POS_CENTER_ON_PARENT );
+ gtk_window_set_modal( GTK_WINDOW( dlg ), TRUE );
- gtk_window_set_title( GTK_WINDOW( dlg ), "Load .prt" );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
++
+ gtk_window_set_title( dlg, "Load .prt" );
+ dlg.connect( "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ dlg.connect( "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
#include <stdio.h>
#include <stdlib.h>
++#include <uilib/uilib.h>
++
#include "profile/profile.h"
#include "qerplugin.h"
Q3R_CMD_LOAD;
-GtkWidget *g_pRadiantWnd = NULL;
++ui::Widget g_pRadiantWnd{ui::null};
const char* QERPlug_Init( void *hApp, void* pMainWidget ){
- g_pRadiantWnd = (GtkWidget*)pMainWidget;
++ g_pRadiantWnd = ui::Window::from(pMainWidget);
return "Portal Viewer for Q3Radiant";
}
#if !defined( INCLUDED_PRTVIEW_H )
#define INCLUDED_PRTVIEW_H
++#include <uilib/uilib.h>
++
#define MSG_PREFIX "Portal Viewer plugin: "
void InitInstance();
void SaveConfig();
-int INIGetInt( char *key, int def );
-void INISetInt( char *key, int val, char *comment = 0 );
-
-typedef struct _GtkWidget GtkWidget;
-extern GtkWidget *g_pRadiantWnd;
+int INIGetInt( const char *key, int def );
+void INISetInt( const char *key, int val, const char *comment = 0 );
-#define IDOK 1
-#define IDCANCEL 2
++extern ui::Widget g_pRadiantWnd;
+
+const int IDOK = 1;
+const int IDCANCEL = 2;
-
#endif
/// \brief Initialisation for things that have the same lifespan as this module.
void CamWnd_Construct(){
- GlobalCommands_insert( "CenterView", FreeCaller<GlobalCamera_ResetAngles>(), Accelerator( GDK_End ) );
- GlobalCommands_insert( "CameraFocusOnSelected", FreeCaller<GlobalCamera_FocusOnSelected>(), Accelerator( GDK_Tab ) );
+ GlobalCommands_insert( "CenterView", makeCallbackF(GlobalCamera_ResetAngles), Accelerator( GDK_KEY_End ) );
++ GlobalCommands_insert( "CameraFocusOnSelected", makeCallbackF( GlobalCamera_FocusOnSelected ), Accelerator( GDK_Tab ) );
- GlobalToggles_insert( "ToggleCubicClip", FreeCaller<Camera_ToggleFarClip>(), ToggleItem::AddCallbackCaller( g_getfarclip_item ), Accelerator( '\\', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "CubicClipZoomIn", FreeCaller<Camera_CubeIn>(), Accelerator( '[', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "CubicClipZoomOut", FreeCaller<Camera_CubeOut>(), Accelerator( ']', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalToggles_insert( "ToggleCubicClip", makeCallbackF(Camera_ToggleFarClip), ToggleItem::AddCallbackCaller( g_getfarclip_item ), Accelerator( '\\', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "CubicClipZoomIn", makeCallbackF(Camera_CubeIn), Accelerator( '[', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "CubicClipZoomOut", makeCallbackF(Camera_CubeOut), Accelerator( ']', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "UpFloor", FreeCaller<Camera_ChangeFloorUp>(), Accelerator( GDK_Prior ) );
- GlobalCommands_insert( "DownFloor", FreeCaller<Camera_ChangeFloorDown>(), Accelerator( GDK_Next ) );
+ GlobalCommands_insert( "UpFloor", makeCallbackF(Camera_ChangeFloorUp), Accelerator( GDK_KEY_Prior ) );
+ GlobalCommands_insert( "DownFloor", makeCallbackF(Camera_ChangeFloorDown), Accelerator( GDK_KEY_Next ) );
GlobalToggles_insert( "ToggleCamera", ToggleShown::ToggleCaller( g_camera_shown ), ToggleItem::AddCallbackCaller( g_camera_shown.m_item ), Accelerator( 'C', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-// GlobalCommands_insert( "LookThroughSelected", FreeCaller<GlobalCamera_LookThroughSelected>() );
-// GlobalCommands_insert( "LookThroughCamera", FreeCaller<GlobalCamera_LookThroughCamera>() );
+// GlobalCommands_insert( "LookThroughSelected", makeCallbackF(GlobalCamera_LookThroughSelected) );
+// GlobalCommands_insert( "LookThroughCamera", makeCallbackF(GlobalCamera_LookThroughCamera) );
if ( g_pGameDescription->mGameType == "doom3" ) {
- GlobalCommands_insert( "TogglePreview", FreeCaller<CamWnd_TogglePreview>(), Accelerator( GDK_F3 ) );
+ GlobalCommands_insert( "TogglePreview", makeCallbackF(CamWnd_TogglePreview), Accelerator( GDK_KEY_F3 ) );
}
- GlobalCommands_insert( "CameraSpeedInc", FreeCaller<CameraSpeed_increase>(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "CameraSpeedDec", FreeCaller<CameraSpeed_decrease>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalCommands_insert( "CameraSpeedInc", makeCallbackF(CameraSpeed_increase), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalCommands_insert( "CameraSpeedDec", makeCallbackF(CameraSpeed_decrease), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalShortcuts_insert( "CameraForward", Accelerator( GDK_Up ) );
- GlobalShortcuts_insert( "CameraBack", Accelerator( GDK_Down ) );
- GlobalShortcuts_insert( "CameraLeft", Accelerator( GDK_Left ) );
- GlobalShortcuts_insert( "CameraRight", Accelerator( GDK_Right ) );
- GlobalShortcuts_insert( "CameraStrafeRight", Accelerator( 'D' ) );
- GlobalShortcuts_insert( "CameraStrafeLeft", Accelerator( 'A' ) );
+ GlobalShortcuts_insert( "CameraForward", Accelerator( GDK_KEY_Up ) );
+ GlobalShortcuts_insert( "CameraBack", Accelerator( GDK_KEY_Down ) );
+ GlobalShortcuts_insert( "CameraLeft", Accelerator( GDK_KEY_Left ) );
+ GlobalShortcuts_insert( "CameraRight", Accelerator( GDK_KEY_Right ) );
+ GlobalShortcuts_insert( "CameraStrafeRight", Accelerator( GDK_KEY_period ) );
+ GlobalShortcuts_insert( "CameraStrafeLeft", Accelerator( GDK_KEY_comma ) );
GlobalShortcuts_insert( "CameraUp", accelerator_null() );
GlobalShortcuts_insert( "CameraDown", accelerator_null() );
g_entity_globals.color_entity = rgb;
}
}
-
- if ( g_pGameDescription->mGameType == "doom3" ) {
- normalize = false;
- }
-
- if ( color_dialog( GTK_WIDGET( MainFrame_getWindow() ), g_entity_globals.color_entity ) ) {
+ if ( color_dialog( MainFrame_getWindow(), g_entity_globals.color_entity ) ) {
- if ( normalize ) {
- NormalizeColor( g_entity_globals.color_entity );
- }
-
char buffer[128];
sprintf( buffer, "%g %g %g", g_entity_globals.color_entity[0],
g_entity_globals.color_entity[1],
create_menu_item_with_mnemonic( menu_in_menu, "Nudge Right", "SelectNudgeRight" );
create_menu_item_with_mnemonic( menu_in_menu, "Nudge Up", "SelectNudgeUp" );
create_menu_item_with_mnemonic( menu_in_menu, "Nudge Down", "SelectNudgeDown" );
+ menu_separator( menu_in_menu );
+ create_menu_item_with_mnemonic( menu_in_menu, "Nudge +Z", "MoveSelectionUP" );
+ create_menu_item_with_mnemonic( menu_in_menu, "Nudge -Z", "MoveSelectionDOWN" );
}
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Rotate" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Rotate" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
// it will take care of hooking the Sys_OpenURL calls etc.
create_game_help_menu( menu );
-// create_menu_item_with_mnemonic( menu, "Bug report", FreeCaller<OpenBugReportURL>() );
- create_menu_item_with_mnemonic( menu, "Shortcuts", FreeCaller<DoCommandListDlg>() );
- create_menu_item_with_mnemonic( menu, "_About", FreeCaller<DoAbout>() );
+ create_menu_item_with_mnemonic( menu, "Bug report", makeCallbackF(OpenBugReportURL) );
- create_menu_item_with_mnemonic( menu, "Shortcuts list", makeCallbackF(DoCommandListDlg) );
++ create_menu_item_with_mnemonic( menu, "Shortcuts", makeCallbackF(DoCommandListDlg) );
+ create_menu_item_with_mnemonic( menu, "_About", makeCallbackF(DoAbout) );
return help_menu_item;
}
#include "stringio.h"
void MainFrame_Construct(){
- GlobalCommands_insert( "OpenManual", FreeCaller<OpenHelpURL>(), Accelerator( GDK_F1 ) );
-
- GlobalCommands_insert( "Sleep", FreeCaller<thunk_OnSleep>(), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
- GlobalCommands_insert( "NewMap", FreeCaller<NewMap>() );
- GlobalCommands_insert( "OpenMap", FreeCaller<OpenMap>(), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ImportMap", FreeCaller<ImportMap>() );
- GlobalCommands_insert( "SaveMap", FreeCaller<SaveMap>(), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "SaveMapAs", FreeCaller<SaveMapAs>() );
- GlobalCommands_insert( "SaveSelected", FreeCaller<ExportMap>() );
- GlobalCommands_insert( "SaveRegion", FreeCaller<SaveRegion>() );
- GlobalCommands_insert( "RefreshReferences", FreeCaller<RefreshReferences>() );
- GlobalCommands_insert( "ProjectSettings", FreeCaller<DoProjectSettings>() );
- GlobalCommands_insert( "CheckForUpdate", FreeCaller<OpenUpdateURL>() );
- GlobalCommands_insert( "Exit", FreeCaller<Exit>() );
-
- GlobalCommands_insert( "Undo", FreeCaller<Undo>(), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "Redo", FreeCaller<Redo>(), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "Copy", FreeCaller<Copy>(), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "Paste", FreeCaller<Paste>(), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "PasteToCamera", FreeCaller<PasteToCamera>(), Accelerator( 'V', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "CloneSelection", FreeCaller<Selection_Clone>(), Accelerator( GDK_space ) );
- GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller<Selection_Clone_MakeUnique>(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) );
-// GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
- GlobalCommands_insert( "DeleteSelection2", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
- GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( 'Z' ) );
- GlobalCommands_insert( "ParentSelection", FreeCaller<Scene_parentSelected>() );
-// GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
- GlobalCommands_insert( "UnSelectSelection2", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
- GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( 'C' ) );
- GlobalCommands_insert( "InvertSelection", FreeCaller<Select_Invert>(), Accelerator( 'I' ) );
- GlobalCommands_insert( "SelectInside", FreeCaller<Select_Inside>() );
- GlobalCommands_insert( "SelectTouching", FreeCaller<Select_Touching>() );
- GlobalCommands_insert( "ExpandSelectionToEntities", FreeCaller<Scene_ExpandSelectionToEntities>(), Accelerator( 'E', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "Preferences", FreeCaller<PreferencesDialog_showDialog>(), Accelerator( 'P' ) );
-
- GlobalCommands_insert( "ToggleConsole", FreeCaller<Console_ToggleShow>(), Accelerator( 'O' ) );
- GlobalCommands_insert( "ToggleEntityInspector", FreeCaller<EntityInspector_ToggleShow>(), Accelerator( 'N' ) );
- GlobalCommands_insert( "EntityList", FreeCaller<EntityList_toggleShown>(), Accelerator( 'L' ) );
-
-// GlobalCommands_insert( "ShowHidden", FreeCaller<Select_ShowAllHidden>(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
-// GlobalCommands_insert( "HideSelected", FreeCaller<HideSelected>(), Accelerator( 'H' ) );
+ GlobalCommands_insert( "OpenManual", makeCallbackF(OpenHelpURL), Accelerator( GDK_KEY_F1 ) );
+
+ GlobalCommands_insert( "Sleep", makeCallbackF(thunk_OnSleep), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalCommands_insert( "NewMap", makeCallbackF(NewMap) );
+ GlobalCommands_insert( "OpenMap", makeCallbackF(OpenMap), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "ImportMap", makeCallbackF(ImportMap) );
+ GlobalCommands_insert( "SaveMap", makeCallbackF(SaveMap), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "SaveMapAs", makeCallbackF(SaveMapAs) );
+ GlobalCommands_insert( "ExportSelected", makeCallbackF(ExportMap) );
+ GlobalCommands_insert( "SaveRegion", makeCallbackF(SaveRegion) );
+ GlobalCommands_insert( "RefreshReferences", makeCallbackF(VFS_Refresh) );
+ GlobalCommands_insert( "ProjectSettings", makeCallbackF(DoProjectSettings) );
+ GlobalCommands_insert( "Exit", makeCallbackF(Exit) );
+
+ GlobalCommands_insert( "Undo", makeCallbackF(Undo), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "Redo", makeCallbackF(Redo), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "Copy", makeCallbackF(Copy), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "Paste", makeCallbackF(Paste), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "PasteToCamera", makeCallbackF(PasteToCamera), Accelerator( 'V', (GdkModifierType)GDK_MOD1_MASK ) );
+ GlobalCommands_insert( "CloneSelection", makeCallbackF(Selection_Clone), Accelerator( GDK_KEY_space ) );
+ GlobalCommands_insert( "CloneSelectionAndMakeUnique", makeCallbackF(Selection_Clone_MakeUnique), Accelerator( GDK_KEY_space, (GdkModifierType)GDK_SHIFT_MASK ) );
+// GlobalCommands_insert( "DeleteSelection", makeCallbackF(deleteSelection), Accelerator( GDK_KEY_BackSpace ) );
+ GlobalCommands_insert( "DeleteSelection2", makeCallbackF(deleteSelection), Accelerator( GDK_KEY_BackSpace ) );
+ GlobalCommands_insert( "DeleteSelection", makeCallbackF(deleteSelection), Accelerator( 'Z' ) );
+ GlobalCommands_insert( "ParentSelection", makeCallbackF(Scene_parentSelected) );
+// GlobalCommands_insert( "UnSelectSelection", makeCallbackF(Selection_Deselect), Accelerator( GDK_KEY_Escape ) );
+ GlobalCommands_insert( "UnSelectSelection2", makeCallbackF(Selection_Deselect), Accelerator( GDK_KEY_Escape ) );
+ GlobalCommands_insert( "UnSelectSelection", makeCallbackF(Selection_Deselect), Accelerator( 'C' ) );
+ GlobalCommands_insert( "InvertSelection", makeCallbackF(Select_Invert), Accelerator( 'I' ) );
+ GlobalCommands_insert( "SelectInside", makeCallbackF(Select_Inside) );
+ GlobalCommands_insert( "SelectTouching", makeCallbackF(Select_Touching) );
+ GlobalCommands_insert( "ExpandSelectionToEntities", makeCallbackF(Scene_ExpandSelectionToEntities), Accelerator( 'E', (GdkModifierType)( GDK_MOD1_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalCommands_insert( "Preferences", makeCallbackF(PreferencesDialog_showDialog), Accelerator( 'P' ) );
+
+ GlobalCommands_insert( "ToggleConsole", makeCallbackF(Console_ToggleShow), Accelerator( 'O' ) );
+ GlobalCommands_insert( "ToggleEntityInspector", makeCallbackF(EntityInspector_ToggleShow), Accelerator( 'N' ) );
+ GlobalCommands_insert( "EntityList", makeCallbackF(EntityList_toggleShown), Accelerator( 'L' ) );
+
- // GlobalCommands_insert( "ShowHidden", FreeCaller<Select_ShowAllHidden>(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
- // GlobalCommands_insert( "HideSelected", FreeCaller<HideSelected>(), Accelerator( 'H' ) );
++// GlobalCommands_insert( "ShowHidden", makeCallbackF( Select_ShowAllHidden ), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
++// GlobalCommands_insert( "HideSelected", makeCallbackF( HideSelected ), Accelerator( 'H' ) );
+
Select_registerCommands();
- GlobalToggles_insert( "DragVertices", FreeCaller<SelectVertexMode>(), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
- GlobalToggles_insert( "DragEdges", FreeCaller<SelectEdgeMode>(), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
- GlobalToggles_insert( "DragFaces", FreeCaller<SelectFaceMode>(), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) );
+ GlobalToggles_insert( "DragVertices", makeCallbackF(SelectVertexMode), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
+ GlobalToggles_insert( "DragEdges", makeCallbackF(SelectEdgeMode), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
+ GlobalToggles_insert( "DragFaces", makeCallbackF(SelectFaceMode), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) );
- GlobalCommands_insert( "ArbitraryRotation", FreeCaller<DoRotateDlg>(), Accelerator( 'R', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "ArbitraryScale", FreeCaller<DoScaleDlg>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalCommands_insert( "ArbitraryRotation", makeCallbackF(DoRotateDlg), Accelerator( 'R', (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalCommands_insert( "ArbitraryScale", makeCallbackF(DoScaleDlg), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
- GlobalCommands_insert( "BuildMenuCustomize", FreeCaller<DoBuildMenu>() );
- GlobalCommands_insert( "Build_runRecentExecutedBuild", FreeCaller<Build_runRecentExecutedBuild>(), Accelerator( GDK_F5 ) );
+ GlobalCommands_insert( "BuildMenuCustomize", makeCallbackF(DoBuildMenu) );
+ GlobalCommands_insert( "Build_runRecentExecutedBuild", makeCallbackF(Build_runRecentExecutedBuild), Accelerator( GDK_F5 ) );
- GlobalCommands_insert( "FindBrush", FreeCaller<DoFind>() );
+ GlobalCommands_insert( "FindBrush", makeCallbackF(DoFind) );
- GlobalCommands_insert( "MapInfo", FreeCaller<DoMapInfo>(), Accelerator( 'M' ) );
+ GlobalCommands_insert( "MapInfo", makeCallbackF(DoMapInfo), Accelerator( 'M' ) );
- GlobalToggles_insert( "ToggleClipper", FreeCaller<ClipperMode>(), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
+ GlobalToggles_insert( "ToggleClipper", makeCallbackF(ClipperMode), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
- GlobalToggles_insert( "MouseTranslate", FreeCaller<TranslateMode>(), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
- GlobalToggles_insert( "MouseRotate", FreeCaller<RotateMode>(), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
- GlobalToggles_insert( "MouseScale", FreeCaller<ScaleMode>(), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
- GlobalToggles_insert( "MouseDrag", FreeCaller<DragMode>(), ToggleItem::AddCallbackCaller( g_dragmode_button ) );
- GlobalCommands_insert( "MouseRotateOrScale", FreeCaller<ToggleRotateScaleModes>() );
- GlobalCommands_insert( "MouseDragOrScale", FreeCaller<ToggleDragScaleModes>(), Accelerator( 'Q' ) );
+ GlobalToggles_insert( "MouseTranslate", makeCallbackF(TranslateMode), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
+ GlobalToggles_insert( "MouseRotate", makeCallbackF(RotateMode), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
+ GlobalToggles_insert( "MouseScale", makeCallbackF(ScaleMode), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
+ GlobalToggles_insert( "MouseDrag", makeCallbackF(DragMode), ToggleItem::AddCallbackCaller( g_dragmode_button ) );
+ GlobalCommands_insert( "MouseRotateOrScale", makeCallbackF(ToggleRotateScaleModes) );
+ GlobalCommands_insert( "MouseDragOrScale", makeCallbackF(ToggleDragScaleModes), Accelerator( 'Q' ) );
- GlobalCommands_insert( "gtkThemeDlg", FreeCaller<gtkThemeDlg>() );
- GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller<ColorScheme_Original>() );
- GlobalCommands_insert( "ColorSchemeQER", FreeCaller<ColorScheme_QER>() );
- GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller<ColorScheme_Black>() );
- GlobalCommands_insert( "ColorSchemeYdnar", FreeCaller<ColorScheme_Ydnar>() );
+#ifndef GARUX_DISABLE_GTKTHEME
+ GlobalCommands_insert( "gtkThemeDlg", makeCallbackF(gtkThemeDlg) );
+#endif
+ GlobalCommands_insert( "ColorSchemeOriginal", makeCallbackF(ColorScheme_Original) );
+ GlobalCommands_insert( "ColorSchemeQER", makeCallbackF(ColorScheme_QER) );
+ GlobalCommands_insert( "ColorSchemeBlackAndGreen", makeCallbackF(ColorScheme_Black) );
+ GlobalCommands_insert( "ColorSchemeYdnar", makeCallbackF(ColorScheme_Ydnar) );
GlobalCommands_insert( "ChooseTextureBackgroundColor", makeCallback( g_ColoursMenu.m_textureback ) );
GlobalCommands_insert( "ChooseGridBackgroundColor", makeCallback( g_ColoursMenu.m_xyback ) );
GlobalCommands_insert( "ChooseGridMajorColor", makeCallback( g_ColoursMenu.m_gridmajor ) );
void GLWindow_Construct(){
- GlobalPreferenceSystem().registerPreference( "MouseButtons", make_property_string( g_glwindow_globals.m_nMouseType ) );
-// GlobalPreferenceSystem().registerPreference( "MouseButtons", IntImportStringCaller( g_glwindow_globals.m_nMouseType ), IntExportStringCaller( g_glwindow_globals.m_nMouseType ) );
++// GlobalPreferenceSystem().registerPreference( "MouseButtons", make_property_string( g_glwindow_globals.m_nMouseType ) );
}
void GLWindow_Destroy(){
extern MainFrame* g_pParentWnd;
-GtkWindow* MainFrame_getWindow();
+ui::Window MainFrame_getWindow();
-
+ /*
enum EMouseButtonMode
{
ETwoButton = 0,
void GLWindow_Construct();
void GLWindow_Destroy();
- extern glwindow_globals_t g_glwindow_globals;
+ //extern glwindow_globals_t g_glwindow_globals;
template<typename Value>
class LatchedValue;
-typedef LatchedValue<bool> LatchedBool;
-extern LatchedBool g_Layout_enableDetachableMenus;
+extern LatchedValue<bool> g_Layout_enableDetachableMenus;
void deleteSelection();
show_blocks( false ),
- m_bCamXYUpdate( true ),
+ // m_bCamXYUpdate( true ),
m_bChaseMouse( true ),
- m_bSizePaint( true ){
+ m_bSizePaint( true ),
+
+ g_bCrossHairs( false ){
}
};
};
void XYWnd::OnContextMenu(){
- if ( g_xywindow_globals.m_bRightClick == false ) {
- return;
- }
+ // if ( g_xywindow_globals.m_bRightClick == false ) {
+ // return;
+ // }
- if ( m_mnuDrop == 0 ) { // first time, load it up
- GtkMenu* menu = m_mnuDrop = GTK_MENU( gtk_menu_new() );
+ if ( !m_mnuDrop ) { // first time, load it up
+ auto menu = m_mnuDrop = ui::Menu(ui::New);
EntityClassMenuInserter inserter( menu );
GlobalEntityClassManager().forEach( inserter );
GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) );
- GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_Delete ) );
- GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_Insert ) );
- GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KP_Home ) );
- GlobalCommands_insert( "ViewSide", FreeCaller<XY_Side>(), Accelerator( GDK_KP_Page_Down ) );
- GlobalCommands_insert( "ViewFront", FreeCaller<XY_Front>(), Accelerator( GDK_KP_End ) );
- GlobalCommands_insert( "Zoom100", FreeCaller<XY_Zoom100>() );
- GlobalCommands_insert( "CenterXYView", FreeCaller<XY_Focus>(), Accelerator( GDK_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-
- GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );
-
-// GlobalPreferenceSystem().registerPreference( "NewRightClick", BoolImportStringCaller( g_xywindow_globals.m_bRightClick ), BoolExportStringCaller( g_xywindow_globals.m_bRightClick ) );
- GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", BoolImportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ), BoolExportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ) );
- GlobalPreferenceSystem().registerPreference( "ChaseMouse", BoolImportStringCaller( g_xywindow_globals_private.m_bChaseMouse ), BoolExportStringCaller( g_xywindow_globals_private.m_bChaseMouse ) );
- GlobalPreferenceSystem().registerPreference( "SizePainting", BoolImportStringCaller( g_xywindow_globals_private.m_bSizePaint ), BoolExportStringCaller( g_xywindow_globals_private.m_bSizePaint ) );
- GlobalPreferenceSystem().registerPreference( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) );
- GlobalPreferenceSystem().registerPreference( "NoStipple", BoolImportStringCaller( g_xywindow_globals.m_bNoStipple ), BoolExportStringCaller( g_xywindow_globals.m_bNoStipple ) );
- GlobalPreferenceSystem().registerPreference( "SI_ShowCoords", BoolImportStringCaller( g_xywindow_globals_private.show_coordinates ), BoolExportStringCaller( g_xywindow_globals_private.show_coordinates ) );
- GlobalPreferenceSystem().registerPreference( "SI_ShowOutlines", BoolImportStringCaller( g_xywindow_globals_private.show_outline ), BoolExportStringCaller( g_xywindow_globals_private.show_outline ) );
- GlobalPreferenceSystem().registerPreference( "SI_ShowAxis", BoolImportStringCaller( g_xywindow_globals_private.show_axis ), BoolExportStringCaller( g_xywindow_globals_private.show_axis ) );
-// GlobalPreferenceSystem().registerPreference( "CamXYUpdate", BoolImportStringCaller( g_xywindow_globals_private.m_bCamXYUpdate ), BoolExportStringCaller( g_xywindow_globals_private.m_bCamXYUpdate ) );
- GlobalPreferenceSystem().registerPreference( "ShowWorkzone", BoolImportStringCaller( g_xywindow_globals_private.d_show_work ), BoolExportStringCaller( g_xywindow_globals_private.d_show_work ) );
-
- GlobalPreferenceSystem().registerPreference( "SI_AxisColors0", Vector3ImportStringCaller( g_xywindow_globals.AxisColorX ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorX ) );
- GlobalPreferenceSystem().registerPreference( "SI_AxisColors1", Vector3ImportStringCaller( g_xywindow_globals.AxisColorY ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorY ) );
- GlobalPreferenceSystem().registerPreference( "SI_AxisColors2", Vector3ImportStringCaller( g_xywindow_globals.AxisColorZ ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorZ ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors1", Vector3ImportStringCaller( g_xywindow_globals.color_gridback ), Vector3ExportStringCaller( g_xywindow_globals.color_gridback ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors2", Vector3ImportStringCaller( g_xywindow_globals.color_gridminor ), Vector3ExportStringCaller( g_xywindow_globals.color_gridminor ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors3", Vector3ImportStringCaller( g_xywindow_globals.color_gridmajor ), Vector3ExportStringCaller( g_xywindow_globals.color_gridmajor ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors6", Vector3ImportStringCaller( g_xywindow_globals.color_gridblock ), Vector3ExportStringCaller( g_xywindow_globals.color_gridblock ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors7", Vector3ImportStringCaller( g_xywindow_globals.color_gridtext ), Vector3ExportStringCaller( g_xywindow_globals.color_gridtext ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors8", Vector3ImportStringCaller( g_xywindow_globals.color_brushes ), Vector3ExportStringCaller( g_xywindow_globals.color_brushes ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors9", Vector3ImportStringCaller( g_xywindow_globals.color_viewname ), Vector3ExportStringCaller( g_xywindow_globals.color_viewname ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors10", Vector3ImportStringCaller( g_xywindow_globals.color_clipper ), Vector3ExportStringCaller( g_xywindow_globals.color_clipper ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors11", Vector3ImportStringCaller( g_xywindow_globals.color_selbrushes ), Vector3ExportStringCaller( g_xywindow_globals.color_selbrushes ) );
-
-
- GlobalPreferenceSystem().registerPreference( "XZVIS", makeBoolStringImportCallback( ToggleShownImportBoolCaller( g_xz_front_shown ) ), makeBoolStringExportCallback( ToggleShownExportBoolCaller( g_xz_front_shown ) ) );
- GlobalPreferenceSystem().registerPreference( "YZVIS", makeBoolStringImportCallback( ToggleShownImportBoolCaller( g_yz_side_shown ) ), makeBoolStringExportCallback( ToggleShownExportBoolCaller( g_yz_side_shown ) ) );
+ GlobalCommands_insert( "NextView", makeCallbackF(XY_Next), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); // fixme: doesn't show its shortcut
+ GlobalCommands_insert( "ZoomIn", makeCallbackF(XY_ZoomIn), Accelerator( GDK_KEY_Delete ) );
+ GlobalCommands_insert( "ZoomOut", makeCallbackF(XY_ZoomOut), Accelerator( GDK_KEY_Insert ) );
+ GlobalCommands_insert( "ViewTop", makeCallbackF(XY_Top), Accelerator( GDK_KEY_KP_Home ) );
+ GlobalCommands_insert( "ViewSide", makeCallbackF(XY_Side), Accelerator( GDK_KEY_KP_Page_Down ) );
+ GlobalCommands_insert( "ViewFront", makeCallbackF(XY_Front), Accelerator( GDK_KEY_KP_End ) );
+ GlobalCommands_insert( "Zoom100", makeCallbackF(XY_Zoom100) );
+ GlobalCommands_insert( "CenterXYView", makeCallbackF(XY_Focus), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+
+ GlobalPreferenceSystem().registerPreference( "ClipCaulk", make_property_string( g_clip_useCaulk ) );
+
- GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) );
++// GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) );
+ GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", make_property_string( g_xywindow_globals.m_bImprovedWheelZoom ) );
+ GlobalPreferenceSystem().registerPreference( "ChaseMouse", make_property_string( g_xywindow_globals_private.m_bChaseMouse ) );
+ GlobalPreferenceSystem().registerPreference( "SizePainting", make_property_string( g_xywindow_globals_private.m_bSizePaint ) );
+ GlobalPreferenceSystem().registerPreference( "ShowCrosshair", make_property_string( g_xywindow_globals_private.g_bCrossHairs ) );
+ GlobalPreferenceSystem().registerPreference( "NoStipple", make_property_string( g_xywindow_globals.m_bNoStipple ) );
+ GlobalPreferenceSystem().registerPreference( "SI_ShowCoords", make_property_string( g_xywindow_globals_private.show_coordinates ) );
+ GlobalPreferenceSystem().registerPreference( "SI_ShowOutlines", make_property_string( g_xywindow_globals_private.show_outline ) );
+ GlobalPreferenceSystem().registerPreference( "SI_ShowAxis", make_property_string( g_xywindow_globals_private.show_axis ) );
- GlobalPreferenceSystem().registerPreference( "CamXYUpdate", make_property_string( g_xywindow_globals_private.m_bCamXYUpdate ) );
++// GlobalPreferenceSystem().registerPreference( "CamXYUpdate", make_property_string( g_xywindow_globals_private.m_bCamXYUpdate ) );
+ GlobalPreferenceSystem().registerPreference( "ShowWorkzone", make_property_string( g_xywindow_globals_private.d_show_work ) );
+
+ GlobalPreferenceSystem().registerPreference( "SI_AxisColors0", make_property_string( g_xywindow_globals.AxisColorX ) );
+ GlobalPreferenceSystem().registerPreference( "SI_AxisColors1", make_property_string( g_xywindow_globals.AxisColorY ) );
+ GlobalPreferenceSystem().registerPreference( "SI_AxisColors2", make_property_string( g_xywindow_globals.AxisColorZ ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors1", make_property_string( g_xywindow_globals.color_gridback ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors2", make_property_string( g_xywindow_globals.color_gridminor ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors3", make_property_string( g_xywindow_globals.color_gridmajor ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors6", make_property_string( g_xywindow_globals.color_gridblock ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors7", make_property_string( g_xywindow_globals.color_gridtext ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors8", make_property_string( g_xywindow_globals.color_brushes ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors9", make_property_string( g_xywindow_globals.color_viewname ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors10", make_property_string( g_xywindow_globals.color_clipper ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors11", make_property_string( g_xywindow_globals.color_selbrushes ) );
+
+
+
+
+ GlobalPreferenceSystem().registerPreference( "XZVIS", make_property_string<ToggleShown_Bool>( g_xz_front_shown ) );
+ GlobalPreferenceSystem().registerPreference( "YZVIS", make_property_string<ToggleShown_Bool>( g_yz_side_shown ) );
Orthographic_registerPreferencesPage();
Clipper_registerPreferencesPage();