}
}
+void PatchAutoCapTexture( Patch& patch ) {
+
+ AABB box = patch.localAABB();
+ float x = box.extents.x();
+ float y = box.extents.y();
+ float z = box.extents.z();
+
+ int cap_direction = -1;
+ if ( x < y && x < z )
+ cap_direction = 0;
+ else if ( y < x && y < z )
+ cap_direction = 1;
+ else if ( z < x && z < x )
+ cap_direction = 2;
+
+ if ( cap_direction >= 0 )
+ patch.ProjectTexture(cap_direction);
+ else
+ patch.NaturalTexture();
+}
+
+void Patch_AutoCapTexture(){
+ UndoableCommand command( "patchAutoCapTexture" );
+ Scene_forEachVisibleSelectedPatch( &PatchAutoCapTexture );
+ SceneChangeNotify();
+}
void Patch_makeCaps( Patch& patch, scene::Instance& instance, EPatchCap type, const char* shader ){
if ( ( type == eCapEndCap || type == eCapIEndCap )
NodeSmartReference cap( g_patchCreator->createPatch() );
Node_getTraversable( instance.path().parent() )->insert( cap );
- patch.MakeCap( Node_getPatch( cap ), type, ROW, true );
- Node_getPatch( cap )->SetShader( shader );
+ Patch* cap_patch = Node_getPatch( cap );
+ patch.MakeCap( cap_patch, type, ROW, true );
+ cap_patch->SetShader( shader );
+ PatchAutoCapTexture(*cap_patch);
scene::Path path( instance.path() );
path.pop();
NodeSmartReference cap( g_patchCreator->createPatch() );
Node_getTraversable( instance.path().parent() )->insert( cap );
- patch.MakeCap( Node_getPatch( cap ), type, ROW, false );
- Node_getPatch( cap )->SetShader( shader );
+ Patch* cap_patch = Node_getPatch( cap );
+ patch.MakeCap( cap_patch, type, ROW, false );
+ cap_patch->SetShader( shader );
+ PatchAutoCapTexture(*cap_patch);
scene::Path path( instance.path() );
path.pop();
SceneChangeNotify();
}
-
-void PatchAutoCapTexture( Patch& patch ) {
-
- AABB box = patch.localAABB();
- float x = box.extents.x();
- float y = box.extents.y();
- float z = box.extents.z();
-
- int cap_direction = -1;
- if ( x < y && x < z )
- cap_direction = 0;
- else if ( y < x && y < z )
- cap_direction = 1;
- else if ( z < x && z < x )
- cap_direction = 2;
-
- if ( cap_direction >= 0 )
- patch.ProjectTexture(cap_direction);
- else
- patch.NaturalTexture();
-}
-
-void Patch_AutoCapTexture(){
- UndoableCommand command( "patchAutoCapTexture" );
- Scene_forEachVisibleSelectedPatch( &PatchAutoCapTexture );
- SceneChangeNotify();
-}
-
class PatchFlipTexture
{
int m_axis;
SceneChangeNotify();
}
-void Scene_PatchGetShader_Selected( scene::Graph& graph, CopiedString& name ){
+void Scene_PatchGetShader_Selected( scene::Graph& graph, std::string& name ){
Patch* patch = Scene_GetUltimateSelectedVisiblePatch();
if ( patch != 0 ) {
name = patch->GetShader();
}
void Patch_constructToolbar( GtkToolbar* toolbar ){
- toolbar_append_button( toolbar, "Put caps on the current patch (SHIFT + C)", "curve_cap.bmp", "CapCurrentCurve" );
+ toolbar_append_button( toolbar, "Put caps on the current patch (SHIFT + C)", "cap_curve.png", "CapCurrentCurve" );
}
void Patch_constructMenu( GtkMenu* menu ){
GtkComboBox* width;
GtkComboBox* height;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch density", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog );
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( window, accel );
{
GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Width:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Width:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Height:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Height:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWidget* bevel;
- GtkWidget* ibevel;
- GtkWidget* endcap;
- GtkWidget* iendcap;
- GtkWidget* cylinder;
+ ui::Widget bevel;
+ ui::Widget ibevel;
+ ui::Widget endcap;
+ ui::Widget iendcap;
+ ui::Widget cylinder;
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Cap", dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog );
- GtkAccelGroup *accel_group = gtk_accel_group_new();
+ GtkAccelGroup *accel_group = ui::AccelGroup();
gtk_window_add_accel_group( window, accel_group );
{
gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( radio_vbox ) );
{
- GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) );
+ GtkTable* table = ui::Table( 5, 2, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( radio_vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkImage* image = new_local_image( "cap_bevel.bmp" );
+ GtkImage* image = new_local_image( "cap_bevel.png" );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkImage* image = new_local_image( "cap_endcap.bmp" );
+ GtkImage* image = new_local_image( "cap_endcap.png" );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkImage* image = new_local_image( "cap_ibevel.bmp" );
+ GtkImage* image = new_local_image( "cap_ibevel.png" );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkImage* image = new_local_image( "cap_iendcap.bmp" );
+ GtkImage* image = new_local_image( "cap_iendcap.png" );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkImage* image = new_local_image( "cap_cylinder.bmp" );
+ GtkImage* image = new_local_image( "cap_cylinder.png" );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 4, 5,
(GtkAttachOptions) ( GTK_FILL ),
GSList* group = 0;
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Bevel" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
bevel = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Endcap" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
endcap = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Bevel" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
ibevel = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Endcap" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
iendcap = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Cylinder" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),