}
- class FaceFitTextureW
- {
- float m_s_repeat, m_t_repeat;
- public:
- FaceFitTextureW( float s_repeat, float t_repeat ) : m_s_repeat( s_repeat ), m_t_repeat( t_repeat ){
- }
- void operator()( Face& face ) const {
- face.FitTextureW( m_s_repeat, m_t_repeat );
- }
- };
-
- class FaceFitTextureH
-class FaceFitTexture
--{
--float m_s_repeat, m_t_repeat;
--public:
- FaceFitTextureH( float s_repeat, float t_repeat ) : m_s_repeat( s_repeat ), m_t_repeat( t_repeat ){
-FaceFitTexture( float s_repeat, float t_repeat ) : m_s_repeat( s_repeat ), m_t_repeat( t_repeat ){
--}
--void operator()( Face& face ) const {
- face.FitTextureH( m_s_repeat, m_t_repeat );
- face.FitTexture( m_s_repeat, m_t_repeat );
--}
--};
--
void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTexture( s_repeat, t_repeat ) );
+ Scene_ForEachSelectedBrush_ForEachFace(graph, [&](Face &face) {
+ face.FitTexture(s_repeat, t_repeat);
+ });
SceneChangeNotify();
}
SceneChangeNotify();
}
- void Scene_BrushFitTexture_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTextureW( s_repeat, t_repeat ) );
- SceneChangeNotify();
- }
-
- void Scene_BrushFitTexture_Component_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrushFace( graph, FaceFitTextureW( s_repeat, t_repeat ) );
- SceneChangeNotify();
- }
-
- void Scene_BrushFitTexture_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTextureH( s_repeat, t_repeat ) );
- SceneChangeNotify();
- }
-
- void Scene_BrushFitTexture_Component_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrushFace( graph, FaceFitTextureH( s_repeat, t_repeat ) );
- SceneChangeNotify();
- }
-
TextureProjection g_defaultTextureProjection;
+
const TextureProjection& TextureTransform_getDefault(){
TexDef_Construct_Default( g_defaultTextureProjection );
return g_defaultTextureProjection;
void Scene_BrushSelectByShader_Component( scene::Graph& graph, const char* name );
void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
void Scene_BrushFitTexture_Component_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
- void Scene_BrushFitTexture_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat );
- void Scene_BrushFitTexture_Component_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat );
- void Scene_BrushFitTexture_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat );
- void Scene_BrushFitTexture_Component_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat );
-typedef struct _GtkMenu GtkMenu;
-void Brush_constructMenu( GtkMenu* menu );
+void Brush_constructMenu( ui::Menu menu );
-extern Callback g_texture_lock_status_changed;
+extern Callback<void()> g_texture_lock_status_changed;
void BrushFilters_construct();
void Brush_registerCommands();
{
public:
Project& m_project;
-GtkListStore* m_store;
+ui::ListStore m_store{ui::null};
+ GtkWidget* m_buildView;
bool m_changed;
ProjectList( Project& project ) : m_project( project ), m_changed( false ){
}
project.push_back( Project::value_type( new_text, Build() ) );
gtk_list_store_set( projectList->m_store, &iter, 0, new_text, -1 );
- GtkTreeIter lastIter;
- gtk_list_store_append( projectList->m_store, &lastIter );
+ projectList->m_store.append();
+ //make command field activatable
+ g_signal_emit_by_name( G_OBJECT( gtk_tree_view_get_selection( GTK_TREE_VIEW( projectList->m_buildView ) ) ), "changed" );
}
gtk_tree_path_free( path );
}
-GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Build Menu", G_CALLBACK( dialog_delete_callback ), &modal, -1, 400 );
-
- GtkWidget* buildView = 0;
+ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Build Menu", G_CALLBACK(dialog_delete_callback ), &modal, -1, 400 );
{
- GtkTable* table1 = create_dialog_table( 2, 2, 4, 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( table1 ) );
+ auto table1 = create_dialog_table( 2, 2, 4, 4, 4 );
+ window.add(table1);
{
- GtkVBox* vbox = create_dialog_vbox( 4 );
- gtk_table_attach( table1, GTK_WIDGET( vbox ), 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+ auto vbox = create_dialog_vbox( 4 );
+ table1.attach(vbox, {1, 2, 0, 1}, {GTK_FILL, GTK_FILL});
{
- GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &modal );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+ auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &modal );
+ vbox.pack_start( button, FALSE, FALSE, 0 );
}
{
- GtkButton* button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &modal );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+ auto button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &modal );
+ vbox.pack_start( button, FALSE, FALSE, 0 );
}
}
+ auto buildViewStore = ui::ListStore::from(gtk_list_store_new( 1, G_TYPE_STRING ));
+ auto buildView = ui::TreeView( ui::TreeModel::from( buildViewStore._handle ));
{
- GtkFrame* frame = create_dialog_frame( "Build menu" );
- gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
+ auto frame = create_dialog_frame( "Build menu" );
+ table1.attach(frame, {0, 1, 0, 1});
{
- GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( scr ) );
+ auto scr = create_scrolled_window( ui::Policy::NEVER, ui::Policy::AUTOMATIC, 4 );
+ frame.add(scr);
{
- GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
+ auto view = buildView;
+ auto store = buildViewStore;
+ gtk_tree_view_set_headers_visible(view, FALSE );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
- gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
-
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText(ui::New);
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
- g_signal_connect( renderer, "edited", G_CALLBACK( project_cell_edited ), &projectList );
+ renderer.connect("edited", G_CALLBACK( project_cell_edited ), &projectList );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
- gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
+ gtk_tree_view_append_column(view, column );
- GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
+ auto selection = gtk_tree_view_get_selection(view );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE );
- gtk_widget_show( view );
+ view.show();
- buildView = view;
+ projectList.m_buildView = buildView;
projectList.m_store = store;
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
- g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( project_key_press ), &projectList );
+ view.connect( "key_press_event", G_CALLBACK( project_key_press ), &projectList );
- g_object_unref( G_OBJECT( store ) );
+ store.unref();
}
}
}
namespace
{
-GtkWidget* g_entity_split1 = 0;
-GtkWidget* g_entity_split2 = 0;
+ GtkWidget* g_entity_split0 = 0;
+ui::Widget g_entity_split1{ui::null};
+ui::Widget g_entity_split2{ui::null};
+ int g_entitysplit0_position;
int g_entitysplit1_position;
int g_entitysplit2_position;
return FALSE;
}
-void EntityInspector_destroyWindow( GtkWidget* widget, gpointer data ){
+void EntityInspector_destroyWindow( ui::Widget widget, gpointer data ){
+ g_entitysplit0_position = gtk_paned_get_position( GTK_PANED( g_entity_split0 ) );
g_entitysplit1_position = gtk_paned_get_position( GTK_PANED( g_entity_split1 ) );
g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) );
-
g_entityInspector_windowConstructed = false;
GlobalEntityAttributes_clear();
}
return FALSE;
}
-GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
- GtkWidget* vbox = gtk_vbox_new( FALSE, 2 );
- gtk_widget_show( vbox );
+ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
+ auto vbox = ui::VBox( FALSE, 2 );
+ vbox.show();
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
- g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_destroyWindowKB ), 0 );
+ g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_hideWindowKB ), 0 );
- g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
+ vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
{
- GtkWidget* split1 = gtk_vpaned_new();
- gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 );
- gtk_widget_show( split1 );
+ auto split1 = ui::VPaned(ui::New);
+ vbox.pack_start( split1, TRUE, TRUE, 0 );
+ split1.show();
g_entity_split1 = split1;
{
- GtkWidget* split2 = gtk_vpaned_new();
+ ui::Widget split2 = ui::VPaned(ui::New);
- gtk_paned_add1( GTK_PANED( split1 ), split2 );
+ //gtk_paned_add1( GTK_PANED( split1 ), split2 );
+ gtk_paned_pack1( GTK_PANED( split1 ), split2, FALSE, FALSE );
- gtk_widget_show( split2 );
+ split2.show();
g_entity_split2 = split2;
{
// class list
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
- gtk_widget_show( scr );
+ auto scr = ui::ScrolledWindow(ui::New);
+ scr.show();
- gtk_paned_add1( GTK_PANED( split2 ), scr );
+ //gtk_paned_add1( GTK_PANED( split2 ), scr );
+ gtk_paned_pack1( GTK_PANED( split2 ), scr, FALSE, FALSE );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
}
{
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
- gtk_widget_show( scr );
+ auto scr = ui::ScrolledWindow(ui::New);
+ scr.show();
- gtk_paned_add2( GTK_PANED( split2 ), scr );
+ //gtk_paned_add2( GTK_PANED( split2 ), scr );
+ gtk_paned_pack2( GTK_PANED( split2 ), scr, FALSE, FALSE );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
}
{
- ui::Widget split2 = ui::VPaned(ui::New);
- gtk_paned_add2( GTK_PANED( split1 ), split2 );
- split2.show();
- GtkWidget* split0 = gtk_vpaned_new();
++ ui::Widget split0 = ui::VPaned(ui::New);
+ //gtk_paned_add2( GTK_PANED( split1 ), split0 );
+ gtk_paned_pack2( GTK_PANED( split1 ), split0, FALSE, FALSE );
- gtk_widget_show( split0 );
++ split0.show();
+ g_entity_split0 = split0;
{
- GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 );
- gtk_widget_show( vbox2 );
+ auto vbox2 = ui::VBox( FALSE, 2 );
+ vbox2.show();
- gtk_paned_pack1( GTK_PANED( split2 ), vbox2, FALSE, FALSE );
+ gtk_paned_pack1( GTK_PANED( split0 ), vbox2, FALSE, FALSE );
{
// Spawnflags (4 colums wide max, or window gets too wide.)
}
{
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
- gtk_widget_show( scr );
+ auto scr = ui::ScrolledWindow(ui::New);
+ scr.show();
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
- GtkWidget* viewport = gtk_viewport_new( 0, 0 );
- gtk_widget_show( viewport );
+ auto viewport = ui::Container::from(gtk_viewport_new( 0, 0 ));
+ viewport.show();
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport ), GTK_SHADOW_NONE );
- g_attributeBox = GTK_VBOX( gtk_vbox_new( FALSE, 2 ) );
- gtk_widget_show( GTK_WIDGET( g_attributeBox ) );
+ g_attributeBox = ui::VBox( FALSE, 2 );
+ g_attributeBox.show();
- gtk_container_add( GTK_CONTAINER( viewport ), GTK_WIDGET( g_attributeBox ) );
- gtk_container_add( GTK_CONTAINER( scr ), viewport );
+ viewport.add(g_attributeBox);
+ scr.add(viewport);
- gtk_paned_pack2( GTK_PANED( split2 ), scr, FALSE, FALSE );
+ gtk_paned_pack2( GTK_PANED( split0 ), scr, FALSE, FALSE );
}
}
}
void EntityInspector_construct(){
GlobalEntityClassManager().attach( g_EntityInspector );
- GlobalPreferenceSystem().registerPreference( "EntitySplit1", IntImportStringCaller( g_entitysplit1_position ), IntExportStringCaller( g_entitysplit1_position ) );
- GlobalPreferenceSystem().registerPreference( "EntitySplit2", IntImportStringCaller( g_entitysplit2_position ), IntExportStringCaller( g_entitysplit2_position ) );
+ GlobalPreferenceSystem().registerPreference( "EntitySplit0", IntImportStringCaller( g_entitysplit0_position ), IntExportStringCaller( g_entitysplit0_position ) );
+ GlobalPreferenceSystem().registerPreference( "EntitySplit1", make_property_string( g_entitysplit1_position ) );
+ GlobalPreferenceSystem().registerPreference( "EntitySplit2", make_property_string( g_entitysplit2_position ) );
}
FindTextureDialog::~FindTextureDialog(){
}
-GtkWindow* FindTextureDialog::BuildDialog(){
- GtkWidget* vbox, *hbox, *table, *label;
- GtkWidget* button, *check, *entry;
+ui::Window FindTextureDialog::BuildDialog(){
+ ui::Widget label{ui::null};
+ ui::Widget button{ui::null};
+ ui::Entry entry{ui::null};
- GtkWindow* dlg = create_floating_window( "Find / Replace Texture(s)", m_parent );
+ auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
- hbox = gtk_hbox_new( FALSE, 5 );
- gtk_widget_show( hbox );
- gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) );
+ m_position_tracker.connect( dlg );
+
+ auto hbox = ui::HBox( FALSE, 5 );
+ hbox.show();
+ dlg.add(hbox);
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
- vbox = gtk_vbox_new( FALSE, 5 );
- gtk_widget_show( vbox );
- gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
-
- table = gtk_table_new( 2, 2, FALSE );
- gtk_widget_show( table );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
- gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
- gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
-
- label = gtk_label_new( "Find:" );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ auto vbox = ui::VBox( FALSE, 5 );
+ vbox.show();
+ hbox.pack_start( vbox, TRUE, TRUE, 0 );
+
+ auto table = ui::Table(2, 2, FALSE);
+ table.show();
+ vbox.pack_start( table, TRUE, TRUE, 0 );
+ gtk_table_set_row_spacings(table, 5);
+ gtk_table_set_col_spacings(table, 5);
+
+ label = ui::Label( "Find:" );
+ label.show();
+ table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0});
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
- label = gtk_label_new( "Replace:" );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ label = ui::Label( "Replace:" );
+ label.show();
+ table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0});
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- g_signal_connect( G_OBJECT( entry ), "focus_in_event",
+ entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
+ entry.connect( "focus_in_event",
G_CALLBACK( find_focus_in ), 0 );
- AddDialogData( *GTK_ENTRY( entry ), m_strFind );
- GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- g_signal_connect( G_OBJECT( entry ), "focus_in_event",
+ AddDialogData( entry, m_strFind );
+ GlobalTextureEntryCompletion::instance().connect( entry );
+
+ entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ entry.connect( "focus_in_event",
G_CALLBACK( replace_focus_in ), 0 );
- AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
- GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
-
- check = gtk_check_button_new_with_label( "Within selected brushes only" );
- gtk_widget_show( check );
- gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
- AddDialogData( *GTK_TOGGLE_BUTTON( check ), m_bSelectedOnly );
-
- vbox = gtk_vbox_new( FALSE, 5 );
- gtk_widget_show( vbox );
- gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
-
- button = gtk_button_new_with_label( "Apply" );
- gtk_widget_show( button );
- gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked",
+ AddDialogData( entry, m_strReplace );
+ GlobalTextureEntryCompletion::instance().connect( entry );
+
+ auto check = ui::CheckButton( "Within selected brushes only" );
+ check.show();
+ vbox.pack_start( check, TRUE, TRUE, 0 );
+ AddDialogData( check, m_bSelectedOnly );
+
+ vbox = ui::VBox( FALSE, 5 );
+ vbox.show();
+ hbox.pack_start( vbox, FALSE, FALSE, 0 );
+
+ button = ui::Button( "Apply" );
+ button.show();
+ vbox.pack_start( button, FALSE, FALSE, 0 );
+ button.connect( "clicked",
G_CALLBACK( OnApply ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ button.dimensions(60, -1);
- button = gtk_button_new_with_label( "Close" );
- gtk_widget_show( button );
- gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked",
+ button = ui::Button( "Close" );
+ button.show();
+ vbox.pack_start( button, FALSE, FALSE, 0 );
+ button.connect( "clicked",
G_CALLBACK( OnClose ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ button.dimensions(60, -1);
return dlg;
}
}
{
- GtkVBox* vbox2 = create_dialog_vbox( 4 );
- gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), FALSE, TRUE, 0 );
+ auto vbox2 = create_dialog_vbox( 4 );
+ hbox.pack_start( vbox2, FALSE, TRUE, 0 );
{
- GtkButton* button = create_modal_dialog_button( "OK", ok_button );
- gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+ auto button = create_modal_dialog_button( "OK", ok_button );
+ vbox2.pack_start( button, FALSE, FALSE, 0 );
}
{
- GtkButton* button = create_dialog_button( "Credits", G_CALLBACK( about_button_credits ), 0 );
- gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+ auto button = create_dialog_button( "Credits", G_CALLBACK( about_button_credits ), 0 );
+ vbox2.pack_start( button, FALSE, FALSE, 0 );
+ gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE);
}
{
- GtkButton* button = create_dialog_button( "Changelog", G_CALLBACK( about_button_changelog ), 0 );
- gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+ auto button = create_dialog_button( "Changes", G_CALLBACK( about_button_changelog ), 0 );
+ vbox2.pack_start( button, FALSE, FALSE, 0 );
+ }
+ {
+ auto button = create_dialog_button( "Issues", G_CALLBACK( about_button_issues ), 0 );
+ vbox2.pack_start( button, FALSE, FALSE, 0 );
+ gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE);
}
}
}
toolbar_append_toggle_button( toolbar, "Clipper (X)", "view_clipper.png", "ToggleClipper" );
}
-void XYWnd_constructToolbar( GtkToolbar* toolbar ){
+void XYWnd_constructToolbar( ui::Toolbar toolbar ){
- toolbar_append_button( toolbar, "Change views", "view_change.png", "NextView" );
+ toolbar_append_button( toolbar, "Change views (CTRL + TAB)", "view_change.png", "NextView" );
}
-void Manipulators_constructToolbar( GtkToolbar* toolbar ){
+void Manipulators_constructToolbar( ui::Toolbar toolbar ){
toolbar_append_toggle_button( toolbar, "Translate (W)", "select_mousetranslate.png", "MouseTranslate" );
toolbar_append_toggle_button( toolbar, "Rotate (R)", "select_mouserotate.png", "MouseRotate" );
toolbar_append_toggle_button( toolbar, "Scale", "select_mousescale.png", "MouseScale" );
ComponentModes_constructToolbar( toolbar );
- if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft || style == MainFrame::eFloating ) {
+ if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
XYWnd_constructToolbar( toolbar );
}
Patch_constructToolbar( toolbar );
}
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
- toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT + T)", "texture_lock.png", "TogTexLock" );
+ toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT +T)", "texture_lock.png", "TogTexLock" );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
- GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
- // disable the console and texture button in the regular layouts
- if ( style != MainFrame::eRegular && style != MainFrame::eRegularLeft ) {
- GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
- GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+ /*auto g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
- auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
- auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
++ if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
++ auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
++ auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+ }
-
// TODO: call light inspector
//GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
- GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
+ space();
+ /*auto g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
-
- // disable the console and texture button in the regular layouts
- if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
- gtk_widget_set_sensitive( g_view_console_button , FALSE );
- gtk_widget_set_sensitive( g_view_textures_button , FALSE );
- }
-
return toolbar;
}
gtk_widget_hide( GTK_WIDGET( plugin_toolbar ) );
}*/
-
-
-
- GtkWidget* main_statusbar = create_main_statusbar( m_pStatusLabel );
- gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 );
+ ui::Widget main_statusbar = create_main_statusbar(reinterpret_cast<ui::Widget *>(m_pStatusLabel));
+ vbox.pack_end(main_statusbar, FALSE, TRUE, 2);
GroupDialog_constructWindow( window );
+
+ /* want to realize it immediately; otherwise gtk paned splits positions wont be set correctly for floating group dlg */
+ gtk_widget_realize ( GTK_WIDGET( GroupDialog_getWindow() ) );
+
g_page_entity = GroupDialog_addPage( "Entities", EntityInspector_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Entities" ) );
if ( FloatingGroupDialog() ) {
// so we need to have at least one initialisation somewhere
entry_set_float( entry, g_pi_globals.shift[0] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( window ), "hshift_adj", adj );
-
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
- gtk_widget_show( GTK_WIDGET( spin ) );
- gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
- (GtkAttachOptions)( 0 ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
+ adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), (gpointer) entry );
+ g_object_set_data( G_OBJECT( window ), "hshift_adj", (gpointer) adj );
+
+ auto spin = ui::SpinButton( adj, 1, 0 );
+ spin.show();
+ table.attach(spin, {1, 2, 0, 1}, {0, 0});
- spin.dimensions(10, -1);
++ spin.dimensions(16, -2);
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
- gtk_widget_show( GTK_WIDGET( entry ) );
- gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 1, 2,
- (GtkAttachOptions)( GTK_FILL ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 1, 2}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
entry_set_float( entry, g_pi_globals.shift[1] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( window ), "vshift_adj", adj );
-
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
- gtk_widget_show( GTK_WIDGET( spin ) );
- gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
- (GtkAttachOptions)( 0 ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
+ adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ g_object_set_data( G_OBJECT( window ), "vshift_adj", (gpointer) adj );
+
+ auto spin = ui::SpinButton( adj, 1, 0 );
+ spin.show();
+ table.attach(spin, {1, 2, 1, 2}, {0, 0});
- spin.dimensions(10, -1);
++ spin.dimensions(16, -2);
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
- gtk_widget_show( GTK_WIDGET( entry ) );
- gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 2, 3,
- (GtkAttachOptions)( GTK_FILL ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 2, 3}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
entry_set_float( entry, g_pi_globals.scale[0] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( window ), "hscale_adj", adj );
-
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
- gtk_widget_show( GTK_WIDGET( spin ) );
- gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
- (GtkAttachOptions)( 0 ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
+ adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ g_object_set_data( G_OBJECT( window ), "hscale_adj", (gpointer) adj );
+
+ auto spin = ui::SpinButton( adj, 1, 0 );
+ spin.show();
+ table.attach(spin, {1, 2, 2, 3}, {0, 0});
- spin.dimensions(10, -1);
++ spin.dimensions(16, -2);
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
- gtk_widget_show( GTK_WIDGET( entry ) );
- gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 3, 4,
- (GtkAttachOptions)( GTK_FILL ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 3, 4}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
entry_set_float( entry, g_pi_globals.scale[1] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( window ), "vscale_adj", adj );
-
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
- gtk_widget_show( GTK_WIDGET( spin ) );
- gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4,
- (GtkAttachOptions)( 0 ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
+ adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ g_object_set_data( G_OBJECT( window ), "vscale_adj", (gpointer) adj );
+
+ auto spin = ui::SpinButton( adj, 1, 0 );
+ spin.show();
+ table.attach(spin, {1, 2, 3, 4}, {0, 0});
- spin.dimensions(10, -1);
++ spin.dimensions(16, -2);
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
- gtk_widget_show( GTK_WIDGET( entry ) );
- gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 4, 5,
- (GtkAttachOptions)( GTK_FILL ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 4, 5}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
entry_set_float( entry, g_pi_globals.rotate );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( window ), "rotate_adj", adj );
-
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
- gtk_widget_show( GTK_WIDGET( spin ) );
- gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5,
- (GtkAttachOptions)( 0 ),
- (GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
+ adj.connect( "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ g_object_set_data( G_OBJECT( window ), "rotate_adj", (gpointer) adj );
+
+ auto spin = ui::SpinButton( adj, 1, 0 );
+ spin.show();
+ table.attach(spin, {1, 2, 4, 5}, {0, 0});
- spin.dimensions(10, -1);
++ spin.dimensions(16, -2);
+ gtk_widget_set_can_focus( spin, false );
}
}
- GtkHBox* hbox2 = GTK_HBOX( gtk_hbox_new( TRUE, 5 ) );
- gtk_widget_show( GTK_WIDGET( hbox2 ) );
- gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox2 ), TRUE, FALSE, 0 );
+ auto hbox2 = ui::HBox( TRUE, 5 );
+ hbox2.show();
+ vbox2.pack_start( hbox2, TRUE, FALSE, 0 );
+ {
+ auto button = ui::Button( "Auto Cap" );
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
+ button.dimensions(60, -1);
+ }
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) );
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ auto button = ui::Button( "CAP" );
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
+ button.dimensions(60, -1);
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Set..." ) );
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ auto button = ui::Button( "Set..." );
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
+ button.dimensions(60, -1);
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Natural" ) );
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ auto button = ui::Button( "Natural" );
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
+ button.dimensions(60, -1);
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Fit" ) );
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ auto button = ui::Button( "Fit" );
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
+ button.dimensions(60, -1);
}
}
}
void SurfaceInspector_FitTextureH(){
UndoableCommand undo( "textureAutoFitH" );
- Select_FitTextureH( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
+ Select_FitTexture( 0, getSurfaceInspector().m_fitVertical );
}
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
Patch_CapTexture();
}
m_xmlInputBuffer = NULL;
}
m_eState = EIdle;
- if ( s_routine_id ) {
+ if ( s_routine_id != 0 ) {
- gtk_timeout_remove( s_routine_id );
+ g_source_remove( s_routine_id );
+ s_routine_id = 0;
}
}