#include "brushmanip.h"
#include "brushnode.h"
#include "grid.h"
+
/*
void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
if ( face.contributes() ) {
BrushGatherSelected( brush_vector_t& brushlist )
: m_brushlist( brushlist ){
}
+
bool pre( const scene::Path& path, scene::Instance& instance ) const {
if ( path.top().get().visible() ) {
Brush* brush = Node_getBrush( path.top() );
{
const Functor& functor;
public:
-typedef typename RemoveReference<typename Functor::first_argument_type>::type* first_argument_type;
-typedef typename Functor::result_type result_type;
Dereference( const Functor& functor ) : functor( functor ){
}
-result_type operator()( first_argument_type firstArgument ) const {
+get_result_type<Functor> operator()( typename RemoveReference<get_argument<Functor, 0>>::type *firstArgument ) const {
return functor( *firstArgument );
}
};
template<typename Caller>
class BindArguments1
{
-typedef typename Caller::second_argument_type FirstBound;
+typedef get_argument<Caller, 1> FirstBound;
FirstBound firstBound;
public:
-typedef typename Caller::result_type result_type;
-typedef typename Caller::first_argument_type first_argument_type;
BindArguments1( FirstBound firstBound )
: firstBound( firstBound ){
}
-result_type operator()( first_argument_type firstArgument ) const {
+
+get_result_type<Caller> operator()( get_argument<Caller, 0> firstArgument ) const {
return Caller::call( firstArgument, firstBound );
}
};
template<typename Caller>
class BindArguments2
{
-typedef typename Caller::second_argument_type FirstBound;
-typedef typename Caller::third_argument_type SecondBound;
+typedef get_argument<Caller, 1> FirstBound;
+typedef get_argument<Caller, 2> SecondBound;
FirstBound firstBound;
SecondBound secondBound;
public:
-typedef typename Caller::result_type result_type;
-typedef typename Caller::first_argument_type first_argument_type;
BindArguments2( FirstBound firstBound, SecondBound secondBound )
: firstBound( firstBound ), secondBound( secondBound ){
}
-result_type operator()( first_argument_type firstArgument ) const {
+
+get_result_type<Caller> operator()( get_argument<Caller, 0> firstArgument ) const {
return Caller::call( firstArgument, firstBound, secondBound );
}
};
inline bool Face_testPlane( const Face& face, const Plane3& plane, bool flipped ){
return face.contributes() && !Winding_TestPlane( face.getWinding(), plane, flipped );
}
-typedef Function3<const Face&, const Plane3&, bool, bool, Face_testPlane> FaceTestPlane;
+typedef Function<bool ( const Face &, const Plane3 &, bool ), Face_testPlane> FaceTestPlane;
/// \brief Returns true if
SubtractBrushesFromUnselected( const brush_vector_t& brushlist, std::size_t& before, std::size_t& after )
: m_brushlist( brushlist ), m_before( before ), m_after( after ){
}
+
bool pre( const scene::Path& path, scene::Instance& instance ) const {
return true;
}
+
void post( const scene::Path& path, scene::Instance& instance ) const {
if ( path.top().get().visible() ) {
Brush* brush = Node_getBrush( path.top() );
BrushSplitByPlaneSelected( const Vector3& p0, const Vector3& p1, const Vector3& p2, const char* shader, const TextureProjection& projection, EBrushSplit split )
: m_p0( p0 ), m_p1( p1 ), m_p2( p2 ), m_shader( shader ), m_projection( projection ), m_split( split ){
}
+
bool pre( const scene::Path& path, scene::Instance& instance ) const {
return true;
}
+
void post( const scene::Path& path, scene::Instance& instance ) const {
if ( path.top().get().visible() ) {
Brush* brush = Node_getBrush( path.top() );
BrushInstanceSetClipPlane( const Plane3& plane )
: m_plane( plane ){
}
+
bool pre( const scene::Path& path, scene::Instance& instance ) const {
BrushInstance* brush = Instance_getBrush( instance );
if ( brush != 0
struct CSGToolDialog
{
GtkSpinButton* spin;
- GtkWindow *window;
+ bool allocated{false};
+ ui::Window window{ui::null};
GtkToggleButton *radXYZ, *radX, *radY, *radZ, *caulk, *removeInner;
};
}
void CSG_Tool(){
- if ( g_csgtool_dialog.window == NULL ) {
- g_csgtool_dialog.window = create_dialog_window( MainFrame_getWindow(), "CSG Tool", G_CALLBACK( CSGdlg_delete ), &g_csgtool_dialog );
+ if ( !g_csgtool_dialog.allocated ) {
+ g_csgtool_dialog.allocated = true;
+ g_csgtool_dialog.window = MainFrame_getWindow().create_dialog_window( "CSG Tool", G_CALLBACK( CSGdlg_delete ), &g_csgtool_dialog );
gtk_window_set_type_hint( g_csgtool_dialog.window, GDK_WINDOW_TYPE_HINT_UTILITY );
//GtkAccelGroup* accel = gtk_accel_group_new();
global_accel_connect_window( g_csgtool_dialog.window );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
+ auto hbox = create_dialog_hbox( 4, 4 );
gtk_container_add( GTK_CONTAINER( g_csgtool_dialog.window ), GTK_WIDGET( hbox ) );
{
- GtkTable* table = create_dialog_table( 3, 8, 4, 4 );
+ auto table = create_dialog_table( 3, 8, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
//GtkWidget* label = gtk_label_new( "<->" );
//gtk_widget_show( label );
- GtkWidget* button = gtk_button_new_with_label( "Grid->" );
- gtk_table_attach( table, button, 0, 1, 0, 1,
- (GtkAttachOptions) ( 0 ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_show( button );
+ auto button = ui::Button( "Grid->" );
+ table.attach( button, {0, 1, 0, 1}, {0, 0} );
+ button.show();
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_grid2spin ), &g_csgtool_dialog );
}
{
}
{
GtkWidget* button = gtk_toggle_button_new();
- button_set_icon( GTK_BUTTON( button ), "f-caulk.png" );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "f-caulk.png" );
gtk_button_set_relief( GTK_BUTTON( button ), GTK_RELIEF_NONE );
- gtk_table_attach( table, button, 6, 7, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach( ubutton, { 6, 7, 0, 1 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Caulk some faces" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
- gtk_widget_show( button );
+ ubutton.show();
g_csgtool_dialog.caulk = GTK_TOGGLE_BUTTON( button );
}
{
GtkWidget* button = gtk_toggle_button_new();
- button_set_icon( GTK_BUTTON( button ), "csgtool_removeinner.png" );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "csgtool_removeinner.png" );
gtk_button_set_relief( GTK_BUTTON( button ), GTK_RELIEF_NONE );
- gtk_table_attach( table, button, 7, 8, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach( ubutton, { 7, 8, 0, 1 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Remove inner brush" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
- gtk_widget_show( button );
+ ubutton.show();
g_csgtool_dialog.removeInner = GTK_TOGGLE_BUTTON( button );
}
{
}
{
GtkWidget* button = gtk_button_new();
- button_set_icon( GTK_BUTTON( button ), "csgtool_shrink.png" );
- gtk_table_attach( table, button, 0, 1, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "csgtool_shrink.png" );
+ table.attach( ubutton, { 0, 1, 2, 3 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Shrink brush" );
- gtk_widget_show( button );
+ ubutton.show();
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_BrushShrink ), &g_csgtool_dialog );
}
{
GtkWidget* button = gtk_button_new();
- button_set_icon( GTK_BUTTON( button ), "csgtool_expand.png" );
- gtk_table_attach( table, button, 1, 2, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "csgtool_expand.png" );
+ table.attach( ubutton, { 1, 2, 2, 3 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Expand brush" );
- gtk_widget_show( button );
+ ubutton.show();
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_BrushExpand ), &g_csgtool_dialog );
}
{
GtkWidget* button = gtk_button_new();
- button_set_icon( GTK_BUTTON( button ), "csgtool_diagonal.png" );
- gtk_table_attach( table, button, 3, 4, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "csgtool_diagonal.png" );
+ table.attach( ubutton, { 3, 4, 2, 3 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Hollow::diagonal joints" );
- gtk_widget_show( button );
+ ubutton.show();
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_HollowDiag ), &g_csgtool_dialog );
}
{
GtkWidget* button = gtk_button_new();
- button_set_icon( GTK_BUTTON( button ), "csgtool_wrap.png" );
- gtk_table_attach( table, button, 4, 5, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "csgtool_wrap.png" );
+ table.attach( ubutton, { 4, 5, 2, 3 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Hollow::warp" );
- gtk_widget_show( button );
+ ubutton.show();
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_HollowWrap ), &g_csgtool_dialog );
}
{
GtkWidget* button = gtk_button_new();
- button_set_icon( GTK_BUTTON( button ), "csgtool_extrude.png" );
- gtk_table_attach( table, button, 5, 6, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "csgtool_extrude.png" );
+ table.attach( ubutton, { 5, 6, 2, 3 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Hollow::extrude faces" );
- gtk_widget_show( button );
+ ubutton.show();
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_HollowExtrude ), &g_csgtool_dialog );
}
{
GtkWidget* button = gtk_button_new();
- button_set_icon( GTK_BUTTON( button ), "csgtool_pull.png" );
- gtk_table_attach( table, button, 6, 7, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ auto ubutton = ui::Button::from( button );
+ button_set_icon( ubutton, "csgtool_pull.png" );
+ table.attach( ubutton, { 6, 7, 2, 3 }, { GTK_EXPAND, 0 } );
gtk_widget_set_tooltip_text( button, "Hollow::pull faces" );
- gtk_widget_show( button );
+ ubutton.show();
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( CSGdlg_HollowPull ), &g_csgtool_dialog );
}