#include "patchdialog.h"
+#include <gtk/gtk.h>
+
#include "itexdef.h"
#include "debugging/debugging.h"
ui::CheckButton m_enabled;
ui::Entry m_horizontal;
ui::Entry m_vertical;
-Subdivisions() : m_enabled( (GtkCheckButton *) 0 ), m_horizontal( nullptr ), m_vertical( nullptr ){
+Subdivisions() : m_enabled( (GtkCheckButton *) 0 ), m_horizontal( ui::null ), m_vertical( ui::null ){
}
void update(){
PatchFixedSubdivisions subdivisions;
}
else
{
- gtk_entry_set_text( m_horizontal, "" );
- gtk_entry_set_text( m_vertical, "" );
+ m_horizontal.text("");
+ m_vertical.text("");
gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), FALSE );
gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), FALSE );
}
float m_fVShift; */
int m_nCol;
int m_nRow;
-ui::ComboBoxText m_pRowCombo{nullptr};
-ui::ComboBoxText m_pColCombo{nullptr};
+ui::ComboBoxText m_pRowCombo{ui::null};
+ui::ComboBoxText m_pColCombo{ui::null};
std::size_t m_countRows;
std::size_t m_countCols;
}
bool visible(){
- return gtk_widget_get_visible( GetWidget() );
+ return GetWidget().visible();
}
// void UpdateInfo();
}
static gint OnDialogKey( ui::Widget widget, GdkEventKey* event, gpointer data ){
- if ( event->keyval == GDK_Return ) {
+ if ( event->keyval == GDK_KEY_Return ) {
OnApply( ui::root, 0 );
return TRUE;
}
- else if ( event->keyval == GDK_Escape ) {
+ else if ( event->keyval == GDK_KEY_Escape ) {
g_PatchInspector.GetPatchInfo();
return TRUE;
}
auto vbox = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
vbox.show();
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ window.add(vbox);
{
auto hbox = ui::HBox( FALSE, 5 );
hbox.show();
auto vbox3 = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
vbox3.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+ frame.add(vbox3);
{
auto table = ui::Table( 2, 2, FALSE );
table.show();
}
{
auto combo = ui::ComboBoxText();
- g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
+ combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( *GTK_COMBO_BOX(combo), m_nRow );
combo.show();
{
auto combo = ui::ComboBoxText();
- g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
+ combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( *GTK_COMBO_BOX(combo), m_nCol );
combo.show();
(GtkAttachOptions)( 0 ), 0, 0 );
AddDialogData( *GTK_ENTRY(entry), m_fX );
- g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
+ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
auto entry = ui::Entry();
(GtkAttachOptions)( 0 ), 0, 0 );
AddDialogData( *GTK_ENTRY(entry), m_fY );
- g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
+ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
auto entry = ui::Entry();
(GtkAttachOptions)( 0 ), 0, 0 );
AddDialogData( *GTK_ENTRY(entry), m_fZ );
- g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
+ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
auto entry = ui::Entry();
(GtkAttachOptions)( 0 ), 0, 0 );
AddDialogData( *GTK_ENTRY(entry), m_fS );
- g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
+ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
auto entry = ui::Entry();
(GtkAttachOptions)( 0 ), 0, 0 );
AddDialogData( *GTK_ENTRY(entry), m_fT );
- g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
+ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
}
}
auto vbox3 = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
vbox3.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+ frame.add(vbox3);
{
auto table = ui::Table( 3, 2, FALSE );
table.show();
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
m_subdivisions.m_enabled = check;
- guint handler_id = g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( &Subdivisions::applyGtk ), &m_subdivisions );
+ guint handler_id = check.connect( "toggled", G_CALLBACK( &Subdivisions::applyGtk ), &m_subdivisions );
g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
}
{
{
auto vbox2 = ui::VBox( FALSE, 5 );
vbox2.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
+ frame.add(vbox2);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
{
auto label = ui::Label( "Name:" );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
AddDialogData( *GTK_ENTRY(entry), m_strName );
- g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
+ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
auto table = ui::Table( 5, 4, FALSE );
gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 );
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 );
gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 );
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 );
gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
- g_object_set_data( G_OBJECT( window ), "hshift_entry", entry );
+ g_object_set_data( G_OBJECT( window ), "hshift_entry", (void *) entry );
// we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
// so we need to have at least one initialisation somewhere
entry_set_float( entry, g_pi_globals.shift[0] );
auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), (gpointer) entry );
+ 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 );
entry_set_float( entry, g_pi_globals.shift[1] );
auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ 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 );
entry_set_float( entry, g_pi_globals.scale[0] );
auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ 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 );
entry_set_float( entry, g_pi_globals.scale[1] );
auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ 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 );
entry_set_float( entry, g_pi_globals.rotate );
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
- g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
+ 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 );
auto button = ui::Button( "Auto Cap" );
button.show();
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
auto button = ui::Button( "CAP" );
button.show();
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
auto button = ui::Button( "Set..." );
button.show();
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
auto button = ui::Button( "Natural" );
button.show();
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
auto button = ui::Button( "Fit" );
button.show();
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
+ button.connect( "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
}