gdk_window_get_origin( gtk_widget_get_window( widget ), &window_x, &window_y);
-
translated_x = current_x - ( window_x );
translated_y = current_y - ( window_y );
self->last_x = reposition_x;
self->last_y = reposition_y;
}
+#else
+#if 0 // NetRadiantCustom
+ int ddx = current_x - self->center_x;
+ int ddy = current_y - self->center_y;
#else
int ddx = current_x - self->recorded_x;
int ddy = current_y - self->recorded_y;
+#endif
if (ddx < -32 || ddx > 32 || ddy < -32 || ddy > 32) {
+#if 0 // NetRadiantCustom
+ Sys_SetCursorPos( widget, self->center_x, self->center_y );
+#else
Sys_SetCursorPos( widget, self->recorded_x, self->recorded_y );
+#endif
self->last_x = self->recorded_x;
self->last_y = self->recorded_y;
}
return FALSE;
}
-// Note: NetRadiantCustom pass both parent and widget.
+/* NetRadiantCustom did this instead:
+void FreezePointer::freeze_pointer(ui::Window window, ui::Widget widget, FreezePointer::MotionDeltaFunction function, void *data) */
void FreezePointer::freeze_pointer(ui::Widget widget, FreezePointer::MotionDeltaFunction function, void *data)
{
/* FIXME: This bug can happen if the pointer goes outside of the
third-party updates that may fix the mouse pointer
visibility issue. */
#else
+#if 0 // NetRadiantCustom
GdkCursor* cursor = create_blank_cursor();
//GdkGrabStatus status =
+ /* fixes cursor runaways during srsly quick drags in camera
+ drags with pressed buttons have no problem at all w/o this */
+ gdk_pointer_grab( gtk_widget_get_window( widget ), TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
+ //gdk_window_set_cursor ( GTK_WIDGET( window )->window, cursor );
+ /* is needed to fix activating neighbour widgets, that happens, if using upper one */
+ gtk_grab_add( widget );
+ weedjet = widget;
+#else
+ GdkCursor* cursor = create_blank_cursor();
+ //GdkGrabStatus status =
gdk_pointer_grab( gtk_widget_get_window( widget ), TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
gdk_cursor_unref( cursor );
+#endif
#endif
Sys_GetCursorPos( widget, &recorded_x, &recorded_y );
- Sys_SetCursorPos( widget, recorded_x, recorded_y );
+#if 0 // NetRadiantCustom
+ /* using center for tracking for max safety */
+ gdk_window_get_origin( GTK_WIDGET( widget )->window, ¢er_x, ¢er_y );
+ auto allocation = widget.dimensions();
+ center_y += allocation.height / 2;
+ center_x += allocation.width / 2;
+
+ Sys_SetCursorPos( widget, center_x, center_y );
+ last_x = center_x;
+ last_y = center_y;
+#else
last_x = recorded_x;
last_y = recorded_y;
+#endif
m_function = function;
m_data = data;
/* The pointer was visible during all the move operation,
so, keep the current position. */
#else
- // Note: NetRadiantCustom still uses window instead of widget.
+ // NetRadiantCustom still uses window instead of widget.
+#if 0 // NetRadiantCustom
+// Sys_SetCursorPos( widget, center_x, center_y );
+#else
Sys_SetCursorPos( widget, recorded_x, recorded_y );
+#endif
#endif
gdk_pointer_ungrab( GDK_CURRENT_TIME );
+
+#if 0 // NetRadiantCustom
+ gtk_grab_remove( weedjet );
+#endif
}
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkEventMotion GdkEventMotion;
-// Note: NetRadiantCustom disables them but we still make use of them.
+// NetRadiantCustom disables them but we still make use of them.
#if 1
GdkCursor* create_blank_cursor();
void set_cursor( ui::Widget widget, GdkCursorType cursor_type );
{
unsigned int handle_motion;
int recorded_x, recorded_y, last_x, last_y, center_x, center_y;
+ui::Widget weedjet{ui::null};
typedef void ( *MotionDeltaFunction )( int x, int y, unsigned int state, void* data );
MotionDeltaFunction m_function;
void* m_data;
public:
FreezePointer() : handle_motion( 0 ), m_function( 0 ), m_data( 0 ){
}
+/* NetRadiantCustom does this instead:
+static gboolean motion_delta( ui::Window widget, GdkEventMotion *event, FreezePointer* self ); */
static gboolean motion_delta( ui::Widget widget, GdkEventMotion *event, FreezePointer* self );
+/* NetRadiantCustom does this instead:
+void freeze_pointer( ui::Window window, ui::Widget widget, MotionDeltaFunction function, void* data ); */
void freeze_pointer( ui::Widget widget, MotionDeltaFunction function, void* data );
+/* NetRadiantCustom does this instead:
+void unfreeze_pointer( ui::Window window ); */
void unfreeze_pointer( ui::Widget widget );
};
char buf[80];
name_t r( "","" );
name_write( buf, name );
+ #ifdef _DEBUG
globalErrorStream() << "find unique name for " << buf << "\n";
globalErrorStream() << "> currently registered names:\n";
+ #endif
for ( names_t::const_iterator i = m_names.begin(); i != m_names.end(); ++i )
{
+ #ifdef _DEBUG
globalErrorStream() << ">> " << i->first.c_str() << ": ";
+ #endif
for ( PostFixes::postfixes_t::const_iterator j = i->second.m_postfixes.begin(); j != i->second.m_postfixes.end(); ++j )
{
j->first.write( buf );
+ #ifdef _DEBUG
globalErrorStream() << " '" << buf << "'";
+ #endif
}
+ #ifdef _DEBUG
globalErrorStream() << "\n";
+ #endif
}
names_t::const_iterator i = m_names.find( name.first );
if ( i == m_names.end() ) {
r = name_t( name.first, ( *i ).second.make_unique( name.second ) );
}
name_write( buf, r );
+ #ifdef _DEBUG
globalErrorStream() << "> unique name is " << buf << "\n";
+ #endif
return r;
}
Texdef_FitTexture( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
}
-void fitW( const Vector3& normal, const Winding& winding, float s_repeat, float t_repeat ){
- Texdef_FitTextureW( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
-}
-
-void fitH( const Vector3& normal, const Winding& winding, float s_repeat, float t_repeat ){
- Texdef_FitTextureH( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
-}
-
void emitTextureCoordinates( Winding& winding, const Vector3& normal, const Matrix4& localToWorld ){
Texdef_EmitTextureCoordinates( m_projection, m_shader.width(), m_shader.height(), winding, normal, localToWorld );
}
texdefChanged();
}
-void FitTextureW( float s_repeat, float t_repeat ){
- undoSave();
- m_texdef.fitW( m_plane.plane3().normal(), m_winding, s_repeat, t_repeat );
- texdefChanged();
-}
-
-void FitTextureH( float s_repeat, float t_repeat ){
- undoSave();
- m_texdef.fitH( m_plane.plane3().normal(), m_winding, s_repeat, t_repeat );
- texdefChanged();
-}
-
void EmitTextureCoordinates(){
Texdef_EmitTextureCoordinates( m_texdefTransformed, m_shader.width(), m_shader.height(), m_winding, plane3().normal(), g_matrix4_identity );
}
bounds.extents.z() = 1;
// the bounds of a perfectly fitted texture transform
- AABB perfect( Vector3( s_repeat * 0.5, t_repeat * 0.5, 0 ), Vector3( s_repeat * 0.5, t_repeat * 0.5, 1 ) );
-
- // the difference between the current texture transform and the perfectly fitted transform
- Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) );
- matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin );
- matrix4_affine_invert( matrix );
-
- // apply the difference to the current texture transform
- matrix4_premultiply_by_matrix4( st2tex, matrix );
-
- Texdef_fromTransform( projection, (float)width, (float)height, st2tex );
- Texdef_normalise( projection, (float)width, (float)height );
-}
-
-void Texdef_FitTextureW( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat ){
- if ( w.numpoints < 3 ) {
- return;
+ AABB perfect;
+ if( t_repeat == 0 && s_repeat == 0 ){
+ //bad user's input
+ t_repeat = s_repeat = 1;
+ perfect.origin = Vector3( s_repeat * 0.5, t_repeat * 0.5, 0 );
+ perfect.extents = Vector3( s_repeat * 0.5, t_repeat * 0.5, 1 );
+ }
+ if( t_repeat == 0 ){
+ //fit width
+ perfect.origin = Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 0 );
+ perfect.extents = Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 1 );
+ }
+ else if( s_repeat == 0 ){
+ //fit height
+ perfect.origin = Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 0 );
+ perfect.extents = Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 1 );
+ }
+ else{
+ perfect.origin = Vector3( s_repeat * 0.5, t_repeat * 0.5, 0 );
+ perfect.extents = Vector3( s_repeat * 0.5, t_repeat * 0.5, 1 );
}
- Matrix4 st2tex;
- Texdef_toTransform( projection, (float)width, (float)height, st2tex );
-
- // the current texture transform
- Matrix4 local2tex = st2tex;
- {
- Matrix4 xyz2st;
- Texdef_basisForNormal( projection, normal, xyz2st );
- matrix4_multiply_by_matrix4( local2tex, xyz2st );
- }
-
- // the bounds of the current texture transform
- AABB bounds;
- for ( Winding::const_iterator i = w.begin(); i != w.end(); ++i )
- {
- Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).vertex );
- aabb_extend_by_point_safe( bounds, texcoord );
- }
- bounds.origin.z() = 0;
- bounds.extents.z() = 1;
-
- // the bounds of a perfectly fitted texture transform
- AABB perfect( Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 0 ), Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 1 ) );
-
- // the difference between the current texture transform and the perfectly fitted transform
- Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) );
- matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin );
- matrix4_affine_invert( matrix );
-
- // apply the difference to the current texture transform
- matrix4_premultiply_by_matrix4( st2tex, matrix );
-
- Texdef_fromTransform( projection, (float)width, (float)height, st2tex );
- Texdef_normalise( projection, (float)width, (float)height );
-}
-
-void Texdef_FitTextureH( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat ){
- if ( w.numpoints < 3 ) {
- return;
- }
-
- Matrix4 st2tex;
- Texdef_toTransform( projection, (float)width, (float)height, st2tex );
-
- // the current texture transform
- Matrix4 local2tex = st2tex;
- {
- Matrix4 xyz2st;
- Texdef_basisForNormal( projection, normal, xyz2st );
- matrix4_multiply_by_matrix4( local2tex, xyz2st );
- }
-
- // the bounds of the current texture transform
- AABB bounds;
- for ( Winding::const_iterator i = w.begin(); i != w.end(); ++i )
- {
- Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).vertex );
- aabb_extend_by_point_safe( bounds, texcoord );
- }
- bounds.origin.z() = 0;
- bounds.extents.z() = 1;
-
- // the bounds of a perfectly fitted texture transform
- AABB perfect( Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 0 ), Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 1 ) );
-
// the difference between the current texture transform and the perfectly fitted transform
Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) );
matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin );
void Texdef_Scale( TextureProjection& projection, float s, float t );
void Texdef_Rotate( TextureProjection& projection, float angle );
void Texdef_FitTexture( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat );
-void Texdef_FitTextureW( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat );
-void Texdef_FitTextureH( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat );
void Texdef_EmitTextureCoordinates( const TextureProjection& projection, std::size_t width, std::size_t height, Winding& w, const Vector3& normal, const Matrix4& localToWorld );
void ShiftScaleRotate_fromFace( texdef_t& shiftScaleRotate, const TextureProjection& projection );
}
-class FaceFitTextureW
-{
-float m_s_repeat, m_t_repeat;
-public:
-FaceFitTextureW( float s_repeat, float t_repeat ) : m_s_repeat( s_repeat ), m_t_repeat( t_repeat ){
-}
-void operator()( Face& face ) const {
- face.FitTextureW( m_s_repeat, m_t_repeat );
-}
-};
-
-class FaceFitTextureH
-{
-float m_s_repeat, m_t_repeat;
-public:
-FaceFitTextureH( float s_repeat, float t_repeat ) : m_s_repeat( s_repeat ), m_t_repeat( t_repeat ){
-}
-void operator()( Face& face ) const {
- face.FitTextureH( m_s_repeat, m_t_repeat );
-}
-};
-
void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat ){
Scene_ForEachSelectedBrush_ForEachFace(graph, [&](Face &face) {
face.FitTexture(s_repeat, t_repeat);
SceneChangeNotify();
}
-void Scene_BrushFitTexture_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTextureW( s_repeat, t_repeat ) );
- SceneChangeNotify();
-}
-
-void Scene_BrushFitTexture_Component_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrushFace( graph, FaceFitTextureW( s_repeat, t_repeat ) );
- SceneChangeNotify();
-}
-
-void Scene_BrushFitTexture_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTextureH( s_repeat, t_repeat ) );
- SceneChangeNotify();
-}
-
-void Scene_BrushFitTexture_Component_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat ){
- Scene_ForEachSelectedBrushFace( graph, FaceFitTextureH( s_repeat, t_repeat ) );
- SceneChangeNotify();
-}
-
TextureProjection g_defaultTextureProjection;
const TextureProjection& TextureTransform_getDefault(){
void Scene_BrushSelectByShader_Component( scene::Graph& graph, const char* name );
void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
void Scene_BrushFitTexture_Component_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_Component_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_Component_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat );
void Brush_constructMenu( ui::Menu menu );
public:
Project& m_project;
ui::ListStore m_store{ui::null};
+GtkWidget* m_buildView;
bool m_changed;
ProjectList( Project& project ) : m_project( project ), m_changed( false ){
}
gtk_list_store_set( projectList->m_store, &iter, 0, new_text, -1 );
projectList->m_store.append();
+ //make command field activatable
+ g_signal_emit_by_name( G_OBJECT( gtk_tree_view_get_selection( GTK_TREE_VIEW( projectList->m_buildView ) ) ), "changed" );
}
gtk_tree_path_free( path );
view.show();
+ projectList.m_buildView = buildView;
projectList.m_store = store;
scr.add(view);
camera.origin -= camera.vright * strafespeed * dx;
if ( camera.m_strafe_forward ) {
- camera.origin += camera.vpn * strafespeed * dy;
+ camera.origin -= camera.vpn * strafespeed * dy;
}
else{
camera.origin += camera.vup * strafespeed * dy;
gtk_window_set_focus( m_parent, m_gl_widget );
m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
- /* Note: We chose to replace m_parent by m_gl_widget but NetRadiantCustom does:
+ /* We chose to replace m_parent by m_gl_widget but NetRadiantCustom does:
m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera ); */
m_freezePointer.freeze_pointer( m_gl_widget, Camera_motionDelta, &m_Camera );
namespace
{
+GtkWidget* g_entity_split0 = 0;
ui::Widget g_entity_split1{ui::null};
ui::Widget g_entity_split2{ui::null};
+int g_entitysplit0_position;
int g_entitysplit1_position;
int g_entitysplit2_position;
}
void EntityInspector_destroyWindow( ui::Widget widget, gpointer data ){
+ g_entitysplit0_position = gtk_paned_get_position( GTK_PANED( g_entity_split0 ) );
g_entitysplit1_position = gtk_paned_get_position( GTK_PANED( g_entity_split1 ) );
g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) );
-
g_entityInspector_windowConstructed = false;
GlobalEntityAttributes_clear();
}
-static gint EntityInspector_destroyWindowKB( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint EntityInspector_hideWindowKB( GtkWidget* widget, GdkEventKey* event, gpointer data ){
//if ( event->keyval == GDK_Escape && GTK_WIDGET_VISIBLE( GTK_WIDGET( widget ) ) ) {
if ( event->keyval == GDK_Escape ) {
- //globalErrorStream() << "Doom3Light_getBounds: failed to parse default light radius\n";
- GroupDialog_showPage( g_page_entity );
+ //GroupDialog_showPage( g_page_entity );
+ gtk_widget_hide( GTK_WIDGET( GroupDialog_getWindow() ) );
return TRUE;
}
if ( event->keyval == GDK_Tab ) {
vbox.show();
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
- g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_destroyWindowKB ), 0 );
+ g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_hideWindowKB ), 0 );
vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
{
{
ui::Widget split2 = ui::VPaned(ui::New);
- gtk_paned_add1( GTK_PANED( split1 ), split2 );
+ //gtk_paned_add1( GTK_PANED( split1 ), split2 );
+ gtk_paned_pack1( GTK_PANED( split1 ), split2, FALSE, FALSE );
split2.show();
g_entity_split2 = split2;
// class list
auto scr = ui::ScrolledWindow(ui::New);
scr.show();
- gtk_paned_add1( GTK_PANED( split2 ), scr );
+ //gtk_paned_add1( GTK_PANED( split2 ), scr );
+ gtk_paned_pack1( GTK_PANED( split2 ), scr, FALSE, FALSE );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
{
auto scr = ui::ScrolledWindow(ui::New);
scr.show();
- gtk_paned_add2( GTK_PANED( split2 ), scr );
+ //gtk_paned_add2( GTK_PANED( split2 ), scr );
+ gtk_paned_pack2( GTK_PANED( split2 ), scr, FALSE, FALSE );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
}
{
- ui::Widget split2 = ui::VPaned(ui::New);
- gtk_paned_add2( GTK_PANED( split1 ), split2 );
- split2.show();
+ ui::Widget split0 = ui::VPaned(ui::New);
+ //gtk_paned_add2( GTK_PANED( split1 ), split0 );
+ gtk_paned_pack2( GTK_PANED( split1 ), split0, FALSE, FALSE );
+ split0.show();
+ g_entity_split0 = split0;
{
auto vbox2 = ui::VBox( FALSE, 2 );
vbox2.show();
- gtk_paned_pack1( GTK_PANED( split2 ), vbox2, FALSE, FALSE );
+ gtk_paned_pack1( GTK_PANED( split0 ), vbox2, FALSE, FALSE );
{
// Spawnflags (4 colums wide max, or window gets too wide.)
viewport.add(g_attributeBox);
scr.add(viewport);
- gtk_paned_pack2( GTK_PANED( split2 ), scr, FALSE, FALSE );
+ gtk_paned_pack2( GTK_PANED( split0 ), scr, FALSE, FALSE );
}
}
}
{
- // show the sliders in any case
- if ( g_entitysplit2_position > 22 ) {
- gtk_paned_set_position( GTK_PANED( g_entity_split2 ), g_entitysplit2_position );
- }
- else {
+ // show the sliders in any case //no need, gtk can care
+ /*if ( g_entitysplit2_position < 22 ) {
g_entitysplit2_position = 22;
- gtk_paned_set_position( GTK_PANED( g_entity_split2 ), 22 );
- }
- if ( ( g_entitysplit1_position - g_entitysplit2_position ) > 27 ) {
- gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit1_position );
- }
- else {
- gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit2_position + 27 );
- }
+ }*/
+ gtk_paned_set_position( GTK_PANED( g_entity_split2 ), g_entitysplit2_position );
+ /*if ( ( g_entitysplit1_position - g_entitysplit2_position ) < 27 ) {
+ g_entitysplit1_position = g_entitysplit2_position + 27;
+ }*/
+ gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit1_position );
+ gtk_paned_set_position( GTK_PANED( g_entity_split0 ), g_entitysplit0_position );
}
g_entityInspector_windowConstructed = true;
void EntityInspector_construct(){
GlobalEntityClassManager().attach( g_EntityInspector );
+ GlobalPreferenceSystem().registerPreference( "EntitySplit0", make_property_string( g_entitysplit0_position ) );
GlobalPreferenceSystem().registerPreference( "EntitySplit1", make_property_string( g_entitysplit1_position ) );
GlobalPreferenceSystem().registerPreference( "EntitySplit2", make_property_string( g_entitysplit2_position ) );
class FindTextureDialog : public Dialog
{
public:
+WindowPositionTracker m_position_tracker;
static void setReplaceStr( const char* name );
static void setFindStr( const char* name );
static bool isOpen();
FindTextureDialog::FindTextureDialog(){
m_bSelectedOnly = FALSE;
+ //m_position_tracker.setPosition( c_default_window_pos );
}
FindTextureDialog::~FindTextureDialog(){
auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
+ m_position_tracker.connect( dlg );
+
auto hbox = ui::HBox( FALSE, 5 );
hbox.show();
dlg.add(hbox);
}
void FindTextureDialog::show(){
+ // workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
+ g_FindTextureDialog.m_position_tracker.sync( g_FindTextureDialog.GetWidget() );
g_FindTextureDialog.ShowDlg();
+ gtk_window_present( g_FindTextureDialog.GetWidget() );
}
g_FindTextureDialog.updateTextures( name );
}
+#include "preferencesystem.h"
+
void FindTextureDialog_Construct(){
GlobalCommands_insert( "FindReplaceTextures", FindTextureDialog::ShowCaller() );
+ GlobalPreferenceSystem().registerPreference( "FindReplacehWnd", make_property_string<WindowPositionTracker_String>( g_FindTextureDialog.m_position_tracker ) );
}
void FindTextureDialog_Destroy(){
{
auto button = create_dialog_button( "Credits", G_CALLBACK( about_button_credits ), 0 );
vbox2.pack_start( button, FALSE, FALSE, 0 );
+ gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE);
}
{
auto button = create_dialog_button( "Changes", G_CALLBACK( about_button_changelog ), 0 );
{
auto button = create_dialog_button( "Issues", G_CALLBACK( about_button_issues ), 0 );
vbox2.pack_start( button, FALSE, FALSE, 0 );
+ gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE);
}
}
}
}
void XYWnd_constructToolbar( ui::Toolbar toolbar ){
- toolbar_append_button( toolbar, "Change views", "view_change.png", "NextView" );
+ toolbar_append_button( toolbar, "Change views (CTRL + TAB)", "view_change.png", "NextView" );
}
void Manipulators_constructToolbar( ui::Toolbar toolbar ){
ComponentModes_constructToolbar( toolbar );
- if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft || style == MainFrame::eFloating ) {
+ if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
space();
XYWnd_constructToolbar( toolbar );
space();
/*auto g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
- auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
- auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+ if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
+ auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
+ auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+ }
// TODO: call light inspector
//GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
space();
/*auto g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
-
- // disable the console and texture button in the regular layouts
- if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
- gtk_widget_set_sensitive( g_view_console_button , FALSE );
- gtk_widget_set_sensitive( g_view_textures_button , FALSE );
- }
-
return toolbar;
}
vbox.pack_end(main_statusbar, FALSE, TRUE, 2);
GroupDialog_constructWindow( window );
+
+ /* want to realize it immediately; otherwise gtk paned splits positions wont be set correctly for floating group dlg */
+ gtk_widget_realize ( GTK_WIDGET( GroupDialog_getWindow() ) );
+
g_page_entity = GroupDialog_addPage( "Entities", EntityInspector_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Entities" ) );
if ( FloatingGroupDialog() ) {
}
else if ( Map_Modified( g_map ) ) {
Map_Save();
+#ifdef WIN32
+ MRU_AddFile( g_map.m_name.c_str() ); //add on saving, but not opening via cmd line: spoils the list
+#endif
}
}
void DoPatchInspector(){
g_PatchInspector.GetPatchInfo();
if ( !g_PatchInspector.visible() ) {
+ // workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
+ g_PatchInspector.m_position_tracker.sync( g_PatchInspector.GetWidget() );
g_PatchInspector.ShowDlg();
}
}
auto spin = ui::SpinButton( adj, 1, 0 );
spin.show();
table.attach(spin, {1, 2, 0, 1}, {0, 0});
- spin.dimensions(10, -1);
+ spin.dimensions(16, -2);
gtk_widget_set_can_focus( spin, false );
}
{
auto spin = ui::SpinButton( adj, 1, 0 );
spin.show();
table.attach(spin, {1, 2, 1, 2}, {0, 0});
- spin.dimensions(10, -1);
+ spin.dimensions(16, -2);
gtk_widget_set_can_focus( spin, false );
}
{
auto spin = ui::SpinButton( adj, 1, 0 );
spin.show();
table.attach(spin, {1, 2, 2, 3}, {0, 0});
- spin.dimensions(10, -1);
+ spin.dimensions(16, -2);
gtk_widget_set_can_focus( spin, false );
}
{
auto spin = ui::SpinButton( adj, 1, 0 );
spin.show();
table.attach(spin, {1, 2, 3, 4}, {0, 0});
- spin.dimensions(10, -1);
+ spin.dimensions(16, -2);
gtk_widget_set_can_focus( spin, false );
}
{
auto spin = ui::SpinButton( adj, 1, 0 );
spin.show();
table.attach(spin, {1, 2, 4, 5}, {0, 0});
- spin.dimensions(10, -1);
+ spin.dimensions(16, -2);
gtk_widget_set_can_focus( spin, false );
}
}
SceneChangeNotify();
}
-void Select_FitTextureW( float horizontal, float vertical ){
- if ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ) {
- Scene_BrushFitTexture_SelectedW( GlobalSceneGraph(), horizontal, vertical );
- }
- Scene_BrushFitTexture_Component_SelectedW( GlobalSceneGraph(), horizontal, vertical );
-
- SceneChangeNotify();
-}
-
-void Select_FitTextureH( float horizontal, float vertical ){
- if ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ) {
- Scene_BrushFitTexture_SelectedH( GlobalSceneGraph(), horizontal, vertical );
- }
- Scene_BrushFitTexture_Component_SelectedH( GlobalSceneGraph(), horizontal, vertical );
-
- SceneChangeNotify();
-}
-
inline void hide_node( scene::Node& node, bool hide ){
hide
? node.enable( scene::Node::eHidden )
void Select_ScaleTexture( float x, float y );
void Select_ShiftTexture( float x, float y );
void Select_FitTexture( float horizontal = 1, float vertical = 1 );
-void Select_FitTextureW( float horizontal = 1, float vertical = 1 );
-void Select_FitTextureH( float horizontal = 1, float vertical = 1 );
void FindReplaceTextures( const char* pFind, const char* pReplace, bool bSelected );
void HideSelected();
}
getSurfaceInspector().Update();
- getSurfaceInspector().importData();
+ //getSurfaceInspector().importData(); //happens in .ShowDlg() anyway
getSurfaceInspector().ShowDlg();
}
void SurfaceInspector_FitTextureW(){
UndoableCommand undo( "textureAutoFitW" );
- Select_FitTextureW( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
+ Select_FitTexture( getSurfaceInspector().m_fitHorizontal, 0 );
}
void SurfaceInspector_FitTextureH(){
UndoableCommand undo( "textureAutoFitH" );
- Select_FitTextureH( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
+ Select_FitTexture( 0, getSurfaceInspector().m_fitVertical );
}
static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
void TextureBrowser_Tracking_MouseUp( TextureBrowser& textureBrowser ){
textureBrowser.m_move_started = false;
- /* Note: NetRadiantCustom did this instead:
+ /* NetRadiantCustom did this instead:
textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget ); */
textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget );
TextureBrowser_Tracking_MouseUp( textureBrowser );
}
textureBrowser.m_move_started = true;
- /* Note: NetRadiantCustom did this instead:
+ /* NetRadiantCustom did this instead:
textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_parent, textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser ); */
textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser );
}
}
else
{
- globalErrorStream() << "Unable to find default tag file " << default_filename.c_str() << ". No tag support.\n";
+ globalOutputStream() << "Unable to find default tag file " << default_filename.c_str() << ". No tag support. Plugins -> ShaderPlug -> Create tag file: to start using tags\n";
}
}
}
// ------------------------------------------------------------------------------------------------
-guint s_routine_id;
+guint s_routine_id = 0;
static gint watchbsp_routine( gpointer data ){
reinterpret_cast<CWatchBSP*>( data )->RoutineProcessing();
return TRUE;
m_xmlInputBuffer = NULL;
}
m_eState = EIdle;
- if ( s_routine_id ) {
+ if ( s_routine_id != 0 ) {
g_source_remove( s_routine_id );
+ s_routine_id = 0;
}
}
Move_End();
}
m_move_started = true;
- /* Note: NetRadiantCustom did this instead:
+ /* NetRadiantCustom did this instead:
g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this ); */
g_xywnd_freezePointer.freeze_pointer( m_gl_widget, XYWnd_moveDelta, this );
m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
}
m_zoom_started = true;
g_dragZoom = 0;
- /* Note: NetRadiantCustom did this instead:
+ /* NetRadiantCustom did this instead:
g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this ); */
g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );