2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 // Leonardo Zide (leo@lokigames.com)
28 #include "patchdialog.h"
32 #include "debugging/debugging.h"
34 #include "gtkutil/idledraw.h"
35 #include "gtkutil/entry.h"
36 #include "gtkutil/button.h"
37 #include "gtkutil/nonmodal.h"
40 #include "mainframe.h"
41 #include "patchmanip.h"
44 #include "preferences.h"
45 #include "signal/isignal.h"
48 #include <gdk/gdkkeysyms.h>
50 // the increment we are using for the patch inspector (this is saved in the prefs)
66 pi_globals_t g_pi_globals;
68 class PatchFixedSubdivisions
71 PatchFixedSubdivisions() : m_enabled( false ), m_x( 0 ), m_y( 0 ){
73 PatchFixedSubdivisions( bool enabled, std::size_t x, std::size_t y ) : m_enabled( enabled ), m_x( x ), m_y( y ){
80 void Patch_getFixedSubdivisions( const Patch& patch, PatchFixedSubdivisions& subdivisions ){
81 subdivisions.m_enabled = patch.m_patchDef3;
82 subdivisions.m_x = patch.m_subdivisions_x;
83 subdivisions.m_y = patch.m_subdivisions_y;
86 const std::size_t MAX_PATCH_SUBDIVISIONS = 32;
88 void Patch_setFixedSubdivisions( Patch& patch, const PatchFixedSubdivisions& subdivisions ){
91 patch.m_patchDef3 = subdivisions.m_enabled;
92 patch.m_subdivisions_x = subdivisions.m_x;
93 patch.m_subdivisions_y = subdivisions.m_y;
95 if ( patch.m_subdivisions_x == 0 ) {
96 patch.m_subdivisions_x = 4;
98 else if ( patch.m_subdivisions_x > MAX_PATCH_SUBDIVISIONS ) {
99 patch.m_subdivisions_x = MAX_PATCH_SUBDIVISIONS;
101 if ( patch.m_subdivisions_y == 0 ) {
102 patch.m_subdivisions_y = 4;
104 else if ( patch.m_subdivisions_y > MAX_PATCH_SUBDIVISIONS ) {
105 patch.m_subdivisions_y = MAX_PATCH_SUBDIVISIONS;
109 Patch_textureChanged();
110 patch.controlPointsChanged();
113 class PatchGetFixedSubdivisions
115 PatchFixedSubdivisions& m_subdivisions;
117 PatchGetFixedSubdivisions( PatchFixedSubdivisions& subdivisions ) : m_subdivisions( subdivisions ){
119 void operator()( Patch& patch ){
120 Patch_getFixedSubdivisions( patch, m_subdivisions );
125 void Scene_PatchGetFixedSubdivisions( PatchFixedSubdivisions& subdivisions ){
127 if ( GlobalSelectionSystem().countSelected() != 0 ) {
128 Patch* patch = Node_getPatch( GlobalSelectionSystem().ultimateSelected().path().top() );
130 Patch_getFixedSubdivisions( *patch, subdivisions );
134 Scene_forEachVisibleSelectedPatch( PatchGetFixedSubdivisions( subdivisions ) );
138 class PatchSetFixedSubdivisions
140 const PatchFixedSubdivisions& m_subdivisions;
142 PatchSetFixedSubdivisions( const PatchFixedSubdivisions& subdivisions ) : m_subdivisions( subdivisions ){
144 void operator()( Patch& patch ) const {
145 Patch_setFixedSubdivisions( patch, m_subdivisions );
149 void Scene_PatchSetFixedSubdivisions( const PatchFixedSubdivisions& subdivisions ){
150 UndoableCommand command( "patchSetFixedSubdivisions" );
151 Scene_forEachVisibleSelectedPatch( PatchSetFixedSubdivisions( subdivisions ) );
154 typedef struct _GtkCheckButton GtkCheckButton;
159 ui::CheckButton m_enabled;
160 ui::Entry m_horizontal;
161 ui::Entry m_vertical;
162 Subdivisions() : m_enabled( (GtkCheckButton *) 0 ), m_horizontal( nullptr ), m_vertical( nullptr ){
165 PatchFixedSubdivisions subdivisions;
166 Scene_PatchGetFixedSubdivisions( subdivisions );
168 toggle_button_set_active_no_signal( m_enabled, subdivisions.m_enabled );
170 if ( subdivisions.m_enabled ) {
171 entry_set_int( m_horizontal, static_cast<int>( subdivisions.m_x ) );
172 entry_set_int( m_vertical, static_cast<int>( subdivisions.m_y ) );
173 gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), TRUE );
174 gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), TRUE );
178 gtk_entry_set_text( m_horizontal, "" );
179 gtk_entry_set_text( m_vertical, "" );
180 gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), FALSE );
181 gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), FALSE );
187 typedef MemberCaller<Subdivisions, &Subdivisions::cancel> CancelCaller;
189 Scene_PatchSetFixedSubdivisions(
190 PatchFixedSubdivisions(
191 gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( m_enabled ) ) != FALSE,
192 static_cast<std::size_t>( entry_get_int( m_horizontal ) ),
193 static_cast<std::size_t>( entry_get_int( m_vertical ) )
197 typedef MemberCaller<Subdivisions, &Subdivisions::apply> ApplyCaller;
198 static void applyGtk( GtkToggleButton* toggle, Subdivisions* self ){
203 class PatchInspector : public Dialog
205 ui::Window BuildDialog();
206 Subdivisions m_subdivisions;
207 NonModalEntry m_horizontalSubdivisionsEntry;
208 NonModalEntry m_verticalSubdivisionsEntry;
211 WindowPositionTracker m_position_tracker;
215 CopiedString m_strName;
228 ui::ComboBoxText m_pRowCombo{nullptr};
229 ui::ComboBoxText m_pColCombo{nullptr};
230 std::size_t m_countRows;
231 std::size_t m_countCols;
233 // turn on/off processing of the "changed" "value_changed" messages
234 // (need to turn off when we are feeding data in)
235 // NOTE: much more simple than blocking signals
236 bool m_bListenChanged;
239 m_horizontalSubdivisionsEntry( Subdivisions::ApplyCaller( m_subdivisions ), Subdivisions::CancelCaller( m_subdivisions ) ),
240 m_verticalSubdivisionsEntry( Subdivisions::ApplyCaller( m_subdivisions ), Subdivisions::CancelCaller( m_subdivisions ) ),
241 m_idleDraw( MemberCaller<PatchInspector, &PatchInspector::GetPatchInfo>( *this ) ){
252 m_bListenChanged = true;
254 m_position_tracker.setPosition( c_default_window_pos );
258 return gtk_widget_get_visible( GetWidget() );
261 // void UpdateInfo();
262 // void SetPatchInfo();
264 void UpdateSpinners( bool bUp, int nID );
265 // read the current patch on map and initialize m_fX m_fY accordingly
266 void UpdateRowColInfo();
267 // sync the dialog our internal data structures
268 // depending on the flag it will read or write
269 // we use m_nCol m_nRow m_fX m_fY m_fZ m_fS m_fT m_strName
270 // (NOTE: this doesn't actually commit stuff to the map or read from it)
275 PatchInspector g_PatchInspector;
277 void PatchInspector_constructWindow( ui::Window main_window ){
278 g_PatchInspector.m_parent = main_window;
279 g_PatchInspector.Create();
281 void PatchInspector_destroyWindow(){
282 g_PatchInspector.Destroy();
285 void PatchInspector_queueDraw(){
286 if ( g_PatchInspector.visible() ) {
287 g_PatchInspector.m_idleDraw.queueDraw();
291 void DoPatchInspector(){
292 g_PatchInspector.GetPatchInfo();
293 if ( !g_PatchInspector.visible() ) {
294 g_PatchInspector.ShowDlg();
298 void PatchInspector_toggleShown(){
299 if ( g_PatchInspector.visible() ) {
300 g_PatchInspector.m_Patch = 0;
301 g_PatchInspector.HideDlg();
309 // =============================================================================
312 // memorize the current state (that is don't try to undo our do before changing something else)
313 static void OnApply( ui::Widget widget, gpointer data ){
314 g_PatchInspector.exportData();
315 if ( g_PatchInspector.m_Patch != 0 ) {
316 UndoableCommand command( "patchSetTexture" );
317 g_PatchInspector.m_Patch->undoSave();
319 if ( !texdef_name_valid( g_PatchInspector.m_strName.c_str() ) ) {
320 globalErrorStream() << "invalid texture name '" << g_PatchInspector.m_strName.c_str() << "'\n";
321 g_PatchInspector.m_strName = texdef_name_default();
323 g_PatchInspector.m_Patch->SetShader( g_PatchInspector.m_strName.c_str() );
325 std::size_t r = g_PatchInspector.m_nRow;
326 std::size_t c = g_PatchInspector.m_nCol;
327 if ( r < g_PatchInspector.m_Patch->getHeight()
328 && c < g_PatchInspector.m_Patch->getWidth() ) {
329 PatchControl& p = g_PatchInspector.m_Patch->ctrlAt( r,c );
330 p.m_vertex[0] = g_PatchInspector.m_fX;
331 p.m_vertex[1] = g_PatchInspector.m_fY;
332 p.m_vertex[2] = g_PatchInspector.m_fZ;
333 p.m_texcoord[0] = g_PatchInspector.m_fS;
334 p.m_texcoord[1] = g_PatchInspector.m_fT;
335 g_PatchInspector.m_Patch->controlPointsChanged();
340 static void OnSelchangeComboColRow( ui::Widget widget, gpointer data ){
341 if ( !g_PatchInspector.m_bListenChanged ) {
344 // retrieve the current m_nRow and m_nCol, other params are not relevant
345 g_PatchInspector.exportData();
346 // read the changed values ourselves
347 g_PatchInspector.UpdateRowColInfo();
348 // now reflect our changes
349 g_PatchInspector.importData();
352 class PatchSetTextureRepeat
356 PatchSetTextureRepeat( float s, float t ) : m_s( s ), m_t( t ){
358 void operator()( Patch& patch ) const {
359 patch.SetTextureRepeat( m_s, m_t );
363 void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ){
364 Scene_forEachVisibleSelectedPatch( PatchSetTextureRepeat( s, t ) );
368 static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
372 static void OnBtnPatchfit( ui::Widget widget, gpointer data ){
376 static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
377 Patch_NaturalTexture();
380 static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
381 Patch_ResetTexture();
384 static void OnBtnPatchFlipX( ui::Widget widget, gpointer data ){
385 Patch_FlipTextureX();
388 static void OnBtnPatchFlipY( ui::Widget widget, gpointer data ){
389 Patch_FlipTextureY();
392 struct PatchRotateTexture
396 PatchRotateTexture( float angle ) : m_angle( angle ){
398 void operator()( Patch& patch ) const {
399 patch.RotateTexture( m_angle );
403 void Scene_PatchRotateTexture_Selected( scene::Graph& graph, float angle ){
404 Scene_forEachVisibleSelectedPatch( PatchRotateTexture( angle ) );
407 class PatchScaleTexture
411 PatchScaleTexture( float s, float t ) : m_s( s ), m_t( t ){
413 void operator()( Patch& patch ) const {
414 patch.ScaleTexture( m_s, m_t );
418 float Patch_convertScale( float scale ){
428 void Scene_PatchScaleTexture_Selected( scene::Graph& graph, float s, float t ){
429 Scene_forEachVisibleSelectedPatch( PatchScaleTexture( Patch_convertScale( s ), Patch_convertScale( t ) ) );
432 class PatchTranslateTexture
436 PatchTranslateTexture( float s, float t )
437 : m_s( s ), m_t( t ){
439 void operator()( Patch& patch ) const {
440 patch.TranslateTexture( m_s, m_t );
444 void Scene_PatchTranslateTexture_Selected( scene::Graph& graph, float s, float t ){
445 Scene_forEachVisibleSelectedPatch( PatchTranslateTexture( s, t ) );
448 static void OnBtnPatchAutoCap( ui::Widget widget, gpointer data ){
449 Patch_AutoCapTexture();
452 static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
456 td.scale[0] = td.scale[1] = 0;
457 td.shift[0] = td.shift[1] = 0;
459 if ( gtk_adjustment_get_value(adj) == 0 ) {
463 if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "hshift_adj" ) ) {
464 g_pi_globals.shift[0] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
466 if ( gtk_adjustment_get_value(adj) > 0 ) {
467 td.shift[0] = g_pi_globals.shift[0];
470 td.shift[0] = -g_pi_globals.shift[0];
473 else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "vshift_adj" ) ) {
474 g_pi_globals.shift[1] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
476 if ( gtk_adjustment_get_value(adj) > 0 ) {
477 td.shift[1] = g_pi_globals.shift[1];
480 td.shift[1] = -g_pi_globals.shift[1];
483 else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "hscale_adj" ) ) {
484 g_pi_globals.scale[0] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
485 if ( g_pi_globals.scale[0] == 0.0f ) {
488 if ( gtk_adjustment_get_value(adj) > 0 ) {
489 td.scale[0] = g_pi_globals.scale[0];
492 td.scale[0] = -g_pi_globals.scale[0];
495 else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "vscale_adj" ) ) {
496 g_pi_globals.scale[1] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
497 if ( g_pi_globals.scale[1] == 0.0f ) {
500 if ( gtk_adjustment_get_value(adj) > 0 ) {
501 td.scale[1] = g_pi_globals.scale[1];
504 td.scale[1] = -g_pi_globals.scale[1];
507 else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "rotate_adj" ) ) {
508 g_pi_globals.rotate = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
510 if ( gtk_adjustment_get_value(adj) > 0 ) {
511 td.rotate = g_pi_globals.rotate;
514 td.rotate = -g_pi_globals.rotate;
518 gtk_adjustment_set_value(adj, 0);
520 // will scale shift rotate the patch accordingly
523 if ( td.shift[0] || td.shift[1] ) {
524 UndoableCommand command( "patchTranslateTexture" );
525 Scene_PatchTranslateTexture_Selected( GlobalSceneGraph(), td.shift[0], td.shift[1] );
527 else if ( td.scale[0] || td.scale[1] ) {
528 UndoableCommand command( "patchScaleTexture" );
529 Scene_PatchScaleTexture_Selected( GlobalSceneGraph(), td.scale[0], td.scale[1] );
531 else if ( td.rotate ) {
532 UndoableCommand command( "patchRotateTexture" );
533 Scene_PatchRotateTexture_Selected( GlobalSceneGraph(), td.rotate );
536 // update the point-by-point view
537 OnSelchangeComboColRow( ui::root ,0 );
540 static gint OnDialogKey( ui::Widget widget, GdkEventKey* event, gpointer data ){
541 if ( event->keyval == GDK_Return ) {
542 OnApply( ui::root, 0 );
545 else if ( event->keyval == GDK_Escape ) {
546 g_PatchInspector.GetPatchInfo();
552 // =============================================================================
553 // PatchInspector class
555 ui::Window PatchInspector::BuildDialog(){
556 ui::Window window = ui::Window(create_floating_window( "Patch Properties", m_parent ));
558 m_position_tracker.connect( window );
560 global_accel_connect_window( window );
562 window_connect_focus_in_clear_focus_widget( window );
566 GtkVBox* vbox = ui::VBox( FALSE, 5 );
567 gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
568 gtk_widget_show( GTK_WIDGET( vbox ) );
569 gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
571 GtkHBox* hbox = ui::HBox( FALSE, 5 );
572 gtk_widget_show( GTK_WIDGET( hbox ) );
573 gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), TRUE, TRUE, 0 );
575 GtkVBox* vbox2 = ui::VBox( FALSE, 0 );
576 gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 0 );
577 gtk_widget_show( GTK_WIDGET( vbox2 ) );
578 gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, TRUE, 0 );
580 GtkFrame* frame = ui::Frame( "Details" );
581 gtk_widget_show( GTK_WIDGET( frame ) );
582 gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
584 GtkVBox* vbox3 = ui::VBox( FALSE, 5 );
585 gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
586 gtk_widget_show( GTK_WIDGET( vbox3 ) );
587 gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
589 GtkTable* table = ui::Table( 2, 2, FALSE );
590 gtk_widget_show( GTK_WIDGET( table ) );
591 gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
592 gtk_table_set_row_spacings( table, 5 );
593 gtk_table_set_col_spacings( table, 5 );
595 GtkLabel* label = GTK_LABEL( ui::Label( "Row:" ) );
596 gtk_widget_show( GTK_WIDGET( label ) );
597 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
598 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
599 (GtkAttachOptions)( 0 ), 0, 0 );
602 GtkLabel* label = GTK_LABEL( ui::Label( "Column:" ) );
603 gtk_widget_show( GTK_WIDGET( label ) );
604 gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
605 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
606 (GtkAttachOptions)( 0 ), 0, 0 );
609 auto combo = ui::ComboBoxText();
610 g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
611 AddDialogData( *GTK_COMBO_BOX(combo), m_nRow );
613 gtk_widget_show( GTK_WIDGET( combo ) );
614 gtk_table_attach( table, GTK_WIDGET( combo ), 0, 1, 1, 2,
615 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
616 (GtkAttachOptions)( 0 ), 0, 0 );
617 gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
622 auto combo = ui::ComboBoxText();
623 g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
624 AddDialogData( *GTK_COMBO_BOX(combo), m_nCol );
626 gtk_widget_show( GTK_WIDGET( combo ) );
627 gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2,
628 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
629 (GtkAttachOptions)( 0 ), 0, 0 );
630 gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
634 GtkTable* table = ui::Table( 5, 2, FALSE );
635 gtk_widget_show( GTK_WIDGET( table ) );
636 gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
637 gtk_table_set_row_spacings( table, 5 );
638 gtk_table_set_col_spacings( table, 5 );
640 GtkLabel* label = GTK_LABEL( ui::Label( "X:" ) );
641 gtk_widget_show( GTK_WIDGET( label ) );
642 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
643 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
644 (GtkAttachOptions)( 0 ), 0, 0 );
647 GtkLabel* label = GTK_LABEL( ui::Label( "Y:" ) );
648 gtk_widget_show( GTK_WIDGET( label ) );
649 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
650 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
651 (GtkAttachOptions)( 0 ), 0, 0 );
654 GtkLabel* label = GTK_LABEL( ui::Label( "Z:" ) );
655 gtk_widget_show( GTK_WIDGET( label ) );
656 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
657 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
658 (GtkAttachOptions)( 0 ), 0, 0 );
661 GtkLabel* label = GTK_LABEL( ui::Label( "S:" ) );
662 gtk_widget_show( GTK_WIDGET( label ) );
663 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 3, 4,
664 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
665 (GtkAttachOptions)( 0 ), 0, 0 );
668 GtkLabel* label = GTK_LABEL( ui::Label( "T:" ) );
669 gtk_widget_show( GTK_WIDGET( label ) );
670 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 4, 5,
671 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
672 (GtkAttachOptions)( 0 ), 0, 0 );
675 GtkEntry* entry = ui::Entry();
676 gtk_widget_show( GTK_WIDGET( entry ) );
677 gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
678 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
679 (GtkAttachOptions)( 0 ), 0, 0 );
680 AddDialogData( *entry, m_fX );
682 g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
685 GtkEntry* entry = ui::Entry();
686 gtk_widget_show( GTK_WIDGET( entry ) );
687 gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
688 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
689 (GtkAttachOptions)( 0 ), 0, 0 );
690 AddDialogData( *entry, m_fY );
692 g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
695 GtkEntry* entry = ui::Entry();
696 gtk_widget_show( GTK_WIDGET( entry ) );
697 gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
698 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
699 (GtkAttachOptions)( 0 ), 0, 0 );
700 AddDialogData( *entry, m_fZ );
702 g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
705 GtkEntry* entry = ui::Entry();
706 gtk_widget_show( GTK_WIDGET( entry ) );
707 gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 3, 4,
708 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
709 (GtkAttachOptions)( 0 ), 0, 0 );
710 AddDialogData( *entry, m_fS );
712 g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
715 GtkEntry* entry = ui::Entry();
716 gtk_widget_show( GTK_WIDGET( entry ) );
717 gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 4, 5,
718 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
719 (GtkAttachOptions)( 0 ), 0, 0 );
720 AddDialogData( *entry, m_fT );
722 g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
726 if ( g_pGameDescription->mGameType == "doom3" ) {
727 GtkFrame* frame = ui::Frame( "Tesselation" );
728 gtk_widget_show( GTK_WIDGET( frame ) );
729 gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
731 GtkVBox* vbox3 = ui::VBox( FALSE, 5 );
732 gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
733 gtk_widget_show( GTK_WIDGET( vbox3 ) );
734 gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
736 GtkTable* table = ui::Table( 3, 2, FALSE );
737 gtk_widget_show( GTK_WIDGET( table ) );
738 gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
739 gtk_table_set_row_spacings( table, 5 );
740 gtk_table_set_col_spacings( table, 5 );
742 GtkLabel* label = GTK_LABEL( ui::Label( "Fixed" ) );
743 gtk_widget_show( GTK_WIDGET( label ) );
744 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
745 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
746 (GtkAttachOptions)( 0 ), 0, 0 );
749 auto check = ui::CheckButton(GTK_CHECK_BUTTON( gtk_check_button_new() ));
750 gtk_widget_show( GTK_WIDGET( check ) );
751 gtk_table_attach( table, GTK_WIDGET( check ), 1, 2, 0, 1,
752 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
753 (GtkAttachOptions)( 0 ), 0, 0 );
754 m_subdivisions.m_enabled = check;
755 guint handler_id = g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( &Subdivisions::applyGtk ), &m_subdivisions );
756 g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
759 GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal" ) );
760 gtk_widget_show( GTK_WIDGET( label ) );
761 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
762 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
763 (GtkAttachOptions)( 0 ), 0, 0 );
766 auto entry = ui::Entry();
767 gtk_widget_show( GTK_WIDGET( entry ) );
768 gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
769 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
770 (GtkAttachOptions)( 0 ), 0, 0 );
771 m_subdivisions.m_horizontal = entry;
772 m_horizontalSubdivisionsEntry.connect( entry );
775 auto label = GTK_LABEL( ui::Label( "Vertical" ) );
776 gtk_widget_show( GTK_WIDGET( label ) );
777 gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
778 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
779 (GtkAttachOptions)( 0 ), 0, 0 );
782 auto entry = ui::Entry();
783 gtk_widget_show( GTK_WIDGET( entry ) );
784 gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
785 (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
786 (GtkAttachOptions)( 0 ), 0, 0 );
787 m_subdivisions.m_vertical = entry;
788 m_verticalSubdivisionsEntry.connect( entry );
795 GtkFrame* frame = ui::Frame( "Texturing" );
796 gtk_widget_show( GTK_WIDGET( frame ) );
797 gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
799 GtkVBox* vbox2 = ui::VBox( FALSE, 5 );
800 gtk_widget_show( GTK_WIDGET( vbox2 ) );
801 gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
802 gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
804 GtkLabel* label = GTK_LABEL( ui::Label( "Name:" ) );
805 gtk_widget_show( GTK_WIDGET( label ) );
806 gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( label ), TRUE, TRUE, 0 );
807 gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
808 gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
811 GtkEntry* entry = ui::Entry();
812 // gtk_editable_set_editable (GTK_ENTRY (entry), false);
813 gtk_widget_show( GTK_WIDGET( entry ) );
814 gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
815 AddDialogData( *entry, m_strName );
817 g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
820 GtkTable* table = ui::Table( 5, 4, FALSE );
821 gtk_widget_show( GTK_WIDGET( table ) );
822 gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
823 gtk_table_set_row_spacings( table, 5 );
824 gtk_table_set_col_spacings( table, 5 );
826 GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Shift Step" ) );
827 gtk_widget_show( GTK_WIDGET( label ) );
828 gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 0, 1,
829 (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
830 (GtkAttachOptions)( 0 ), 0, 0 );
831 gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
834 GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Shift Step" ) );
835 gtk_widget_show( GTK_WIDGET( label ) );
836 gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 1, 2,
837 (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
838 (GtkAttachOptions)( 0 ), 0, 0 );
839 gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
842 GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Stretch Step" ) );
843 gtk_widget_show( GTK_WIDGET( label ) );
844 gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 2, 3,
845 (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
846 (GtkAttachOptions)( 0 ), 0, 0 );
847 gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
850 GtkButton* button = ui::Button( "Flip" );
851 gtk_widget_show( GTK_WIDGET( button ) );
852 gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3,
853 (GtkAttachOptions)( GTK_FILL ),
854 (GtkAttachOptions)( 0 ), 0, 0 );
855 g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 );
856 gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
859 GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Stretch Step" ) );
860 gtk_widget_show( GTK_WIDGET( label ) );
861 gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 3, 4,
862 (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
863 (GtkAttachOptions)( 0 ), 0, 0 );
864 gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
867 GtkButton* button = ui::Button( "Flip" );
868 gtk_widget_show( GTK_WIDGET( button ) );
869 gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4,
870 (GtkAttachOptions)( GTK_FILL ),
871 (GtkAttachOptions)( 0 ), 0, 0 );
872 g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 );
873 gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
876 GtkLabel* label = GTK_LABEL( ui::Label( "Rotate Step" ) );
877 gtk_widget_show( GTK_WIDGET( label ) );
878 gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 4, 5,
879 (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
880 (GtkAttachOptions)( 0 ), 0, 0 );
881 gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
884 auto entry = ui::Entry();
885 gtk_widget_show( GTK_WIDGET( entry ) );
886 gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 0, 1,
887 (GtkAttachOptions)( GTK_FILL ),
888 (GtkAttachOptions)( 0 ), 0, 0 );
889 gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
890 g_object_set_data( G_OBJECT( window ), "hshift_entry", entry );
891 // we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
892 // so we need to have at least one initialisation somewhere
893 entry_set_float( entry, g_pi_globals.shift[0] );
895 auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
896 g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), (gpointer) entry );
897 g_object_set_data( G_OBJECT( window ), "hshift_adj", (gpointer) adj );
899 auto spin = ui::SpinButton( adj, 1, 0 );
900 gtk_widget_show( GTK_WIDGET( spin ) );
901 gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
902 (GtkAttachOptions)( 0 ),
903 (GtkAttachOptions)( 0 ), 0, 0 );
904 gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
905 gtk_widget_set_can_focus( spin, false );
908 auto entry = ui::Entry();
909 gtk_widget_show( GTK_WIDGET( entry ) );
910 gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 1, 2,
911 (GtkAttachOptions)( GTK_FILL ),
912 (GtkAttachOptions)( 0 ), 0, 0 );
913 gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
914 entry_set_float( entry, g_pi_globals.shift[1] );
916 auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
917 g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
918 g_object_set_data( G_OBJECT( window ), "vshift_adj", (gpointer) adj );
920 auto spin = ui::SpinButton( adj, 1, 0 );
921 gtk_widget_show( GTK_WIDGET( spin ) );
922 gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
923 (GtkAttachOptions)( 0 ),
924 (GtkAttachOptions)( 0 ), 0, 0 );
925 gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
926 gtk_widget_set_can_focus( spin, false );
929 auto entry = ui::Entry();
930 gtk_widget_show( GTK_WIDGET( entry ) );
931 gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 2, 3,
932 (GtkAttachOptions)( GTK_FILL ),
933 (GtkAttachOptions)( 0 ), 0, 0 );
934 gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
935 entry_set_float( entry, g_pi_globals.scale[0] );
937 auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
938 g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
939 g_object_set_data( G_OBJECT( window ), "hscale_adj", (gpointer) adj );
941 auto spin = ui::SpinButton( adj, 1, 0 );
942 gtk_widget_show( GTK_WIDGET( spin ) );
943 gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
944 (GtkAttachOptions)( 0 ),
945 (GtkAttachOptions)( 0 ), 0, 0 );
946 gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
947 gtk_widget_set_can_focus( spin, false );
950 auto entry = ui::Entry();
951 gtk_widget_show( GTK_WIDGET( entry ) );
952 gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 3, 4,
953 (GtkAttachOptions)( GTK_FILL ),
954 (GtkAttachOptions)( 0 ), 0, 0 );
955 gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
956 entry_set_float( entry, g_pi_globals.scale[1] );
958 auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
959 g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
960 g_object_set_data( G_OBJECT( window ), "vscale_adj", (gpointer) adj );
962 auto spin = ui::SpinButton( adj, 1, 0 );
963 gtk_widget_show( GTK_WIDGET( spin ) );
964 gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4,
965 (GtkAttachOptions)( 0 ),
966 (GtkAttachOptions)( 0 ), 0, 0 );
967 gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
968 gtk_widget_set_can_focus( spin, false );
971 auto entry = ui::Entry();
972 gtk_widget_show( GTK_WIDGET( entry ) );
973 gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 4, 5,
974 (GtkAttachOptions)( GTK_FILL ),
975 (GtkAttachOptions)( 0 ), 0, 0 );
976 gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
977 entry_set_float( entry, g_pi_globals.rotate );
979 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
980 g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
981 g_object_set_data( G_OBJECT( window ), "rotate_adj", (gpointer) adj );
983 auto spin = ui::SpinButton( adj, 1, 0 );
984 gtk_widget_show( GTK_WIDGET( spin ) );
985 gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5,
986 (GtkAttachOptions)( 0 ),
987 (GtkAttachOptions)( 0 ), 0, 0 );
988 gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
989 gtk_widget_set_can_focus( spin, false );
992 GtkHBox* hbox2 = ui::HBox( TRUE, 5 );
993 gtk_widget_show( GTK_WIDGET( hbox2 ) );
994 gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox2 ), TRUE, FALSE, 0 );
996 GtkButton* button = ui::Button( "Auto Cap" );
997 gtk_widget_show( GTK_WIDGET( button ) );
998 gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
999 g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
1000 gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
1003 GtkButton* button = ui::Button( "CAP" );
1004 gtk_widget_show( GTK_WIDGET( button ) );
1005 gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
1006 g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
1007 gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
1010 GtkButton* button = ui::Button( "Set..." );
1011 gtk_widget_show( GTK_WIDGET( button ) );
1012 gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
1013 g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
1014 gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
1017 GtkButton* button = ui::Button( "Natural" );
1018 gtk_widget_show( GTK_WIDGET( button ) );
1019 gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
1020 g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
1021 gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
1024 GtkButton* button = ui::Button( "Fit" );
1025 gtk_widget_show( GTK_WIDGET( button ) );
1026 gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
1027 g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
1028 gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
1038 // sync the dialog our internal data structures
1039 void PatchInspector::exportData(){
1040 m_bListenChanged = false;
1041 Dialog::exportData();
1042 m_bListenChanged = true;
1044 void PatchInspector::importData(){
1045 m_bListenChanged = false;
1046 Dialog::importData();
1047 m_bListenChanged = true;
1050 // read the map and feed in the stuff to the dialog box
1051 void PatchInspector::GetPatchInfo(){
1052 if ( g_pGameDescription->mGameType == "doom3" ) {
1053 m_subdivisions.update();
1056 if ( GlobalSelectionSystem().countSelected() == 0 ) {
1061 m_Patch = Node_getPatch( GlobalSelectionSystem().ultimateSelected().path().top() );
1064 if ( m_Patch != 0 ) {
1065 m_strName = m_Patch->GetShader();
1067 // fill in the numbers for Row / Col selection
1068 m_bListenChanged = false;
1071 gtk_combo_box_set_active( m_pRowCombo, 0 );
1073 for ( std::size_t i = 0; i < m_countRows; ++i )
1075 gtk_combo_box_text_remove( m_pRowCombo, gint( m_countRows - i - 1 ) );
1078 m_countRows = m_Patch->getHeight();
1079 for ( std::size_t i = 0; i < m_countRows; ++i )
1082 sprintf( buffer, "%u", Unsigned( i ) );
1083 gtk_combo_box_text_append_text( m_pRowCombo, buffer );
1086 gtk_combo_box_set_active( m_pRowCombo, 0 );
1090 gtk_combo_box_set_active( m_pColCombo, 0 );
1092 for ( std::size_t i = 0; i < m_countCols; ++i )
1094 gtk_combo_box_text_remove( m_pColCombo, gint( m_countCols - i - 1 ) );
1097 m_countCols = m_Patch->getWidth();
1098 for ( std::size_t i = 0; i < m_countCols; ++i )
1101 sprintf( buffer, "%u", Unsigned( i ) );
1102 gtk_combo_box_text_append_text( m_pColCombo, buffer );
1105 gtk_combo_box_set_active( m_pColCombo, 0 );
1108 m_bListenChanged = true;
1113 //globalOutputStream() << "WARNING: no patch\n";
1115 // fill in our internal structs
1116 m_nRow = 0; m_nCol = 0;
1118 // now update the dialog box
1122 // read the current patch on map and initialize m_fX m_fY accordingly
1123 // NOTE: don't call UpdateData in there, it's not meant for
1124 void PatchInspector::UpdateRowColInfo(){
1125 m_fX = m_fY = m_fZ = m_fS = m_fT = 0.0;
1127 if ( m_Patch != 0 ) {
1128 // we rely on whatever active row/column has been set before we get called
1129 std::size_t r = m_nRow;
1130 std::size_t c = m_nCol;
1131 if ( r < m_Patch->getHeight()
1132 && c < m_Patch->getWidth() ) {
1133 const PatchControl& p = m_Patch->ctrlAt( r,c );
1134 m_fX = p.m_vertex[0];
1135 m_fY = p.m_vertex[1];
1136 m_fZ = p.m_vertex[2];
1137 m_fS = p.m_texcoord[0];
1138 m_fT = p.m_texcoord[1];
1144 void PatchInspector_SelectionChanged( const Selectable& selectable ){
1145 PatchInspector_queueDraw();
1149 #include "preferencesystem.h"
1152 void PatchInspector_Construct(){
1153 GlobalCommands_insert( "PatchInspector", FreeCaller<PatchInspector_toggleShown>(), Accelerator( 'S', (GdkModifierType)GDK_SHIFT_MASK ) );
1155 GlobalPreferenceSystem().registerPreference( "PatchWnd", WindowPositionTrackerImportStringCaller( g_PatchInspector.m_position_tracker ), WindowPositionTrackerExportStringCaller( g_PatchInspector.m_position_tracker ) );
1156 GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Scale1", FloatImportStringCaller( g_pi_globals.scale[0] ), FloatExportStringCaller( g_pi_globals.scale[0] ) );
1157 GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Scale2", FloatImportStringCaller( g_pi_globals.scale[1] ), FloatExportStringCaller( g_pi_globals.scale[1] ) );
1158 GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Shift1", FloatImportStringCaller( g_pi_globals.shift[0] ), FloatExportStringCaller( g_pi_globals.shift[0] ) );
1159 GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Shift2", FloatImportStringCaller( g_pi_globals.shift[1] ), FloatExportStringCaller( g_pi_globals.shift[1] ) );
1160 GlobalPreferenceSystem().registerPreference( "SI_PatchTexdef_Rotate", FloatImportStringCaller( g_pi_globals.rotate ), FloatExportStringCaller( g_pi_globals.rotate ) );
1162 typedef FreeCaller1<const Selectable&, PatchInspector_SelectionChanged> PatchInspectorSelectionChangedCaller;
1163 GlobalSelectionSystem().addSelectionChangeCallback( PatchInspectorSelectionChangedCaller() );
1164 typedef FreeCaller<PatchInspector_queueDraw> PatchInspectorQueueDrawCaller;
1165 Patch_addTextureChangedCallback( PatchInspectorQueueDrawCaller() );
1167 void PatchInspector_Destroy(){