typedef std::vector<scene::Instance*> InstanceVector;
-class PatchStoreInstance
-{
-InstanceVector& m_instances;
-public:
-PatchStoreInstance( InstanceVector& instances ) : m_instances( instances ){
-}
-void operator()( PatchInstance& patch ) const {
- m_instances.push_back( &patch );
-}
-};
-
enum ECapDialog {
PATCHCAP_BEVEL = 0,
PATCHCAP_ENDCAP,
}
InstanceVector instances;
- Scene_forEachVisibleSelectedPatchInstance( PatchStoreInstance( instances ) );
+ Scene_forEachVisibleSelectedPatchInstance([&](PatchInstance &patch) {
+ instances.push_back(&patch);
+ });
for ( InstanceVector::const_iterator i = instances.begin(); i != instances.end(); ++i )
{
Patch_makeCaps( *Node_getPatch( ( *i )->path().top() ), *( *i ), eType, shader );
}
-class PatchCapTexture
-{
-public:
-void operator()( Patch& patch ) const {
- patch.ProjectTexture( Patch::m_CycleCapIndex );
-}
-};
-
void Scene_PatchCapTexture_Selected( scene::Graph& graph ){
- Scene_forEachVisibleSelectedPatch( PatchCapTexture() );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.ProjectTexture(Patch::m_CycleCapIndex);
+ });
Patch::m_CycleCapIndex = ( Patch::m_CycleCapIndex == 0 ) ? 1 : ( Patch::m_CycleCapIndex == 1 ) ? 2 : 0;
SceneChangeNotify();
}
-class PatchFlipTexture
-{
-int m_axis;
-public:
-PatchFlipTexture( int axis ) : m_axis( axis ){
-}
-void operator()( Patch& patch ) const {
- patch.FlipTexture( m_axis );
-}
-};
-
void Scene_PatchFlipTexture_Selected( scene::Graph& graph, int axis ){
- Scene_forEachVisibleSelectedPatch( PatchFlipTexture( axis ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.FlipTexture(axis);
+ });
}
-class PatchNaturalTexture
-{
-public:
-void operator()( Patch& patch ) const {
- patch.NaturalTexture();
-}
-};
-
void Scene_PatchNaturalTexture_Selected( scene::Graph& graph ){
- Scene_forEachVisibleSelectedPatch( PatchNaturalTexture() );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.NaturalTexture();
+ });
SceneChangeNotify();
}
-class PatchInsertRemove
-{
-bool m_insert, m_column, m_first;
-public:
-PatchInsertRemove( bool insert, bool column, bool first ) : m_insert( insert ), m_column( column ), m_first( first ){
-}
-void operator()( Patch& patch ) const {
- patch.InsertRemove( m_insert, m_column, m_first );
-}
-};
-
void Scene_PatchInsertRemove_Selected( scene::Graph& graph, bool bInsert, bool bColumn, bool bFirst ){
- Scene_forEachVisibleSelectedPatch( PatchInsertRemove( bInsert, bColumn, bFirst ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.InsertRemove(bInsert, bColumn, bFirst);
+ });
}
-class PatchInvertMatrix
-{
-public:
-void operator()( Patch& patch ) const {
- patch.InvertMatrix();
-}
-};
-
void Scene_PatchInvert_Selected( scene::Graph& graph ){
- Scene_forEachVisibleSelectedPatch( PatchInvertMatrix() );
-}
-
-class PatchRedisperse
-{
-EMatrixMajor m_major;
-public:
-PatchRedisperse( EMatrixMajor major ) : m_major( major ){
-}
-void operator()( Patch& patch ) const {
- patch.Redisperse( m_major );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.InvertMatrix();
+ });
}
-};
void Scene_PatchRedisperse_Selected( scene::Graph& graph, EMatrixMajor major ){
- Scene_forEachVisibleSelectedPatch( PatchRedisperse( major ) );
-}
-
-class PatchSmooth
-{
-EMatrixMajor m_major;
-public:
-PatchSmooth( EMatrixMajor major ) : m_major( major ){
-}
-void operator()( Patch& patch ) const {
- patch.Smooth( m_major );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.Redisperse(major);
+ });
}
-};
void Scene_PatchSmooth_Selected( scene::Graph& graph, EMatrixMajor major ){
- Scene_forEachVisibleSelectedPatch( PatchSmooth( major ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.Smooth(major);
+ });
}
-class PatchTransposeMatrix
-{
-public:
-void operator()( Patch& patch ) const {
- patch.TransposeMatrix();
-}
-};
-
void Scene_PatchTranspose_Selected( scene::Graph& graph ){
- Scene_forEachVisibleSelectedPatch( PatchTransposeMatrix() );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.TransposeMatrix();
+ });
}
-class PatchSetShader
-{
-const char* m_name;
-public:
-PatchSetShader( const char* name )
- : m_name( name ){
-}
-void operator()( Patch& patch ) const {
- patch.SetShader( m_name );
-}
-};
-
void Scene_PatchSetShader_Selected( scene::Graph& graph, const char* name ){
- Scene_forEachVisibleSelectedPatch( PatchSetShader( name ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ patch.SetShader(name);
+ });
SceneChangeNotify();
}
}
}
-class PatchSelectByShader
-{
-const char* m_name;
-public:
-inline PatchSelectByShader( const char* name )
- : m_name( name ){
-}
-void operator()( PatchInstance& patch ) const {
- if ( shader_equal( patch.getPatch().GetShader(), m_name ) ) {
- patch.setSelected( true );
- }
-}
-};
-
void Scene_PatchSelectByShader( scene::Graph& graph, const char* name ){
- Scene_forEachVisiblePatchInstance( PatchSelectByShader( name ) );
+ Scene_forEachVisiblePatchInstance([&](PatchInstance &patch) {
+ if (shader_equal(patch.getPatch().GetShader(), name)) {
+ patch.setSelected(true);
+ }
+ });
}
-class PatchFindReplaceShader
-{
-const char* m_find;
-const char* m_replace;
-public:
-PatchFindReplaceShader( const char* find, const char* replace ) : m_find( find ), m_replace( replace ){
-}
-void operator()( Patch& patch ) const {
- if ( shader_equal( patch.GetShader(), m_find ) ) {
- patch.SetShader( m_replace );
- }
-}
-};
-
void Scene_PatchFindReplaceShader( scene::Graph& graph, const char* find, const char* replace ){
- Scene_forEachVisiblePatch( PatchFindReplaceShader( find, replace ) );
+ Scene_forEachVisiblePatch([&](Patch &patch) {
+ if (shader_equal(patch.GetShader(), find)) {
+ patch.SetShader(replace);
+ }
+ });
}
void Scene_PatchFindReplaceShader_Selected( scene::Graph& graph, const char* find, const char* replace ){
- Scene_forEachVisibleSelectedPatch( PatchFindReplaceShader( find, replace ) );
+ Scene_forEachVisibleSelectedPatch([&](Patch &patch) {
+ if (shader_equal(patch.GetShader(), find)) {
+ patch.SetShader(replace);
+ }
+ });
}
{
auto label = ui::Label( "Width:" );
label.show();
- gtk_table_attach( table, label , 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0});
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
auto label = ui::Label( "Height:" );
label.show();
- gtk_table_attach( table, label , 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0});
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31...
#undef D_ITEM
combo.show();
- gtk_table_attach( table, combo , 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(combo, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
width = combo;
}
D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31...
#undef D_ITEM
combo.show();
- gtk_table_attach( table, combo , 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(combo, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
height = combo;
}
{
auto image = new_local_image( "cap_bevel.png" );
image.show();
- gtk_table_attach( table, image , 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(image, {0, 1, 0, 1}, {GTK_FILL, 0});
}
{
auto image = new_local_image( "cap_endcap.png" );
image.show();
- gtk_table_attach( table, image , 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(image, {0, 1, 1, 2}, {GTK_FILL, 0});
}
{
auto image = new_local_image( "cap_ibevel.png" );
image.show();
- gtk_table_attach( table, image , 0, 1, 2, 3,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(image, {0, 1, 2, 3}, {GTK_FILL, 0});
}
{
auto image = new_local_image( "cap_iendcap.png" );
image.show();
- gtk_table_attach( table, image , 0, 1, 3, 4,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(image, {0, 1, 3, 4}, {GTK_FILL, 0});
}
{
auto image = new_local_image( "cap_cylinder.png" );
image.show();
- gtk_table_attach( table, image , 0, 1, 4, 5,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(image, {0, 1, 4, 5}, {GTK_FILL, 0});
}
GSList* group = 0;
{
ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" ));
button.show();
- gtk_table_attach( table, button, 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(button, {1, 2, 0, 1}, {GTK_FILL | GTK_EXPAND, 0});
group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
bevel = button;
{
ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" ));
button.show();
- gtk_table_attach( table, button, 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(button, {1, 2, 1, 2}, {GTK_FILL | GTK_EXPAND, 0});
group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
endcap = button;
{
ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" ));
button.show();
- gtk_table_attach( table, button, 1, 2, 2, 3,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(button, {1, 2, 2, 3}, {GTK_FILL | GTK_EXPAND, 0});
group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
ibevel = button;
{
ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" ));
button.show();
- gtk_table_attach( table, button, 1, 2, 3, 4,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(button, {1, 2, 3, 4}, {GTK_FILL | GTK_EXPAND, 0});
group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
iendcap = button;
{
ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" ));
button.show();
- gtk_table_attach( table, button, 1, 2, 4, 5,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(button, {1, 2, 4, 5}, {GTK_FILL | GTK_EXPAND, 0});
group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
cylinder = button;