Radiant:
binds... * ctrl + shift + m1 (in texbro): open shader in external editor misc... * fix: do not unmaximize external shader editor on win * fix: blank cursor in radiant after calling external shader editor on win * fix shader editors stuff for non uindowses * 'Shader Editor Command' preference is available on win (is used, if set; otherwise try default os action for file) * fix: 'Shader Editor Command' preference allows selecting executable via dialog * GDK_HAND2 cursor in clipper tool mode * fix: clipper points have numeric labels * '2d zoom in to mouse pointer' option works for alt + m2 zoom * '3d zoom in to mouse pointer' option (def = yes)
This commit is contained in:
parent
87d5b6efe5
commit
dd7f4f1689
|
|
@ -888,8 +888,33 @@ gboolean selection_motion_freemove( GtkWidget *widget, GdkEventMotion *event, Wi
|
||||||
gboolean wheelmove_scroll( GtkWidget* widget, GdkEventScroll* event, CamWnd* camwnd ){
|
gboolean wheelmove_scroll( GtkWidget* widget, GdkEventScroll* event, CamWnd* camwnd ){
|
||||||
if ( event->direction == GDK_SCROLL_UP ) {
|
if ( event->direction == GDK_SCROLL_UP ) {
|
||||||
Camera_Freemove_updateAxes( camwnd->getCamera() );
|
Camera_Freemove_updateAxes( camwnd->getCamera() );
|
||||||
|
if( camwnd->m_bFreeMove || !g_camwindow_globals.m_bZoomInToPointer ){
|
||||||
Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
|
Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
//Matrix4 maa = matrix4_multiplied_by_matrix4( camwnd->getCamera().projection, camwnd->getCamera().modelview );
|
||||||
|
Matrix4 maa = camwnd->getCamera().m_view->GetViewMatrix();
|
||||||
|
matrix4_affine_invert( maa );
|
||||||
|
|
||||||
|
float x = static_cast<float>( event->x );
|
||||||
|
float y = static_cast<float>( event->y );
|
||||||
|
Vector3 normalized;
|
||||||
|
|
||||||
|
normalized[0] = 2.0f * ( x ) / static_cast<float>( camwnd->getCamera().width ) - 1.0f;
|
||||||
|
normalized[1] = 2.0f * ( y )/ static_cast<float>( camwnd->getCamera().height ) - 1.0f;
|
||||||
|
normalized[1] *= -1.f;
|
||||||
|
normalized[2] = 0.f;
|
||||||
|
|
||||||
|
normalized *= 16.0f;
|
||||||
|
//globalOutputStream() << normalized << " normalized ";
|
||||||
|
matrix4_transform_point( maa, normalized );
|
||||||
|
//globalOutputStream() << normalized << "\n";
|
||||||
|
Vector3 norm = vector3_normalised( normalized - Camera_getOrigin( *camwnd ) );
|
||||||
|
//globalOutputStream() << normalized - Camera_getOrigin( *camwnd ) << " normalized - Camera_getOrigin( *camwnd )\n";
|
||||||
|
//globalOutputStream() << norm << " norm\n";
|
||||||
|
Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( norm, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( event->direction == GDK_SCROLL_DOWN ) {
|
else if ( event->direction == GDK_SCROLL_DOWN ) {
|
||||||
Camera_Freemove_updateAxes( camwnd->getCamera() );
|
Camera_Freemove_updateAxes( camwnd->getCamera() );
|
||||||
Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, -static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
|
Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, -static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
|
||||||
|
|
@ -1891,6 +1916,7 @@ void Camera_constructPreferences( PreferencesPage& page ){
|
||||||
page.appendCheckBox( "", "Link strafe speed to movement speed", g_camwindow_globals_private.m_bCamLinkSpeed );
|
page.appendCheckBox( "", "Link strafe speed to movement speed", g_camwindow_globals_private.m_bCamLinkSpeed );
|
||||||
page.appendSlider( "Rotation Speed", g_camwindow_globals_private.m_nAngleSpeed, TRUE, 0, 0, 3, 1, 180, 1, 10 );
|
page.appendSlider( "Rotation Speed", g_camwindow_globals_private.m_nAngleSpeed, TRUE, 0, 0, 3, 1, 180, 1, 10 );
|
||||||
page.appendCheckBox( "", "Invert mouse vertical axis", g_camwindow_globals_private.m_bCamInverseMouse );
|
page.appendCheckBox( "", "Invert mouse vertical axis", g_camwindow_globals_private.m_bCamInverseMouse );
|
||||||
|
page.appendCheckBox( "", "Zoom In to Mouse pointer", g_camwindow_globals.m_bZoomInToPointer );
|
||||||
page.appendCheckBox(
|
page.appendCheckBox(
|
||||||
"", "Discrete movement",
|
"", "Discrete movement",
|
||||||
FreeCaller1<bool, CamWnd_Move_Discrete_Import>(),
|
FreeCaller1<bool, CamWnd_Move_Discrete_Import>(),
|
||||||
|
|
@ -2026,6 +2052,7 @@ void CamWnd_Construct(){
|
||||||
GlobalPreferenceSystem().registerPreference( "SI_Colors12", Vector3ImportStringCaller( g_camwindow_globals.color_selbrushes3d ), Vector3ExportStringCaller( g_camwindow_globals.color_selbrushes3d ) );
|
GlobalPreferenceSystem().registerPreference( "SI_Colors12", Vector3ImportStringCaller( g_camwindow_globals.color_selbrushes3d ), Vector3ExportStringCaller( g_camwindow_globals.color_selbrushes3d ) );
|
||||||
GlobalPreferenceSystem().registerPreference( "CameraRenderMode", makeIntStringImportCallback( RenderModeImportCaller() ), makeIntStringExportCallback( RenderModeExportCaller() ) );
|
GlobalPreferenceSystem().registerPreference( "CameraRenderMode", makeIntStringImportCallback( RenderModeImportCaller() ), makeIntStringExportCallback( RenderModeExportCaller() ) );
|
||||||
GlobalPreferenceSystem().registerPreference( "StrafeMode", IntImportStringCaller( g_camwindow_globals_private.m_nStrafeMode ), IntExportStringCaller( g_camwindow_globals_private.m_nStrafeMode ) );
|
GlobalPreferenceSystem().registerPreference( "StrafeMode", IntImportStringCaller( g_camwindow_globals_private.m_nStrafeMode ), IntExportStringCaller( g_camwindow_globals_private.m_nStrafeMode ) );
|
||||||
|
GlobalPreferenceSystem().registerPreference( "3DZoomInToPointer", BoolImportStringCaller( g_camwindow_globals.m_bZoomInToPointer ), BoolExportStringCaller( g_camwindow_globals.m_bZoomInToPointer ) );
|
||||||
|
|
||||||
CamWnd_constructStatic();
|
CamWnd_constructStatic();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,13 @@ struct camwindow_globals_t
|
||||||
|
|
||||||
int m_nCubicScale;
|
int m_nCubicScale;
|
||||||
|
|
||||||
|
bool m_bZoomInToPointer;
|
||||||
|
|
||||||
camwindow_globals_t() :
|
camwindow_globals_t() :
|
||||||
color_cameraback( 0.25f, 0.25f, 0.25f ),
|
color_cameraback( 0.25f, 0.25f, 0.25f ),
|
||||||
color_selbrushes3d( 1.0f, 0.f, 0.f ),
|
color_selbrushes3d( 1.0f, 0.f, 0.f ),
|
||||||
m_nCubicScale( 14 ){
|
m_nCubicScale( 14 ),
|
||||||
|
m_bZoomInToPointer( true ){
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1338,6 +1338,7 @@ static gint EntityInspector_hideWindowKB( GtkWidget* widget, GdkEventKey* event,
|
||||||
gtk_widget_hide( GTK_WIDGET( GroupDialog_getWindow() ) );
|
gtk_widget_hide( GTK_WIDGET( GroupDialog_getWindow() ) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
/* this doesn't work, if tab is bound (func is not called then) */
|
||||||
if ( event->keyval == GDK_Tab ) {
|
if ( event->keyval == GDK_Tab ) {
|
||||||
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) );
|
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
||||||
|
|
@ -874,9 +874,9 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos, int length )
|
||||||
gtk_widget_show( text_editor );
|
gtk_widget_show( text_editor );
|
||||||
gtk_window_present( GTK_WINDOW( text_editor ) );
|
gtk_window_present( GTK_WINDOW( text_editor ) );
|
||||||
|
|
||||||
#ifdef WIN32
|
//#ifdef WIN32
|
||||||
process_gui();
|
process_gui();
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
// only move the cursor if it's not exceeding the size..
|
// only move the cursor if it's not exceeding the size..
|
||||||
// NOTE: this is erroneous, cursorpos is the offset in bytes, not in characters
|
// NOTE: this is erroneous, cursorpos is the offset in bytes, not in characters
|
||||||
|
|
@ -890,9 +890,9 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos, int length )
|
||||||
gtk_text_view_scroll_to_iter( GTK_TEXT_VIEW( text_widget ), &text_iter, 0, TRUE, 0, 0);
|
gtk_text_view_scroll_to_iter( GTK_TEXT_VIEW( text_widget ), &text_iter, 0, TRUE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
//#ifdef WIN32
|
||||||
gtk_widget_queue_draw( text_widget );
|
gtk_widget_queue_draw( text_widget );
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
text_buffer_ = text_buffer;
|
text_buffer_ = text_buffer;
|
||||||
free( buf );
|
free( buf );
|
||||||
|
|
@ -1088,69 +1088,59 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char*
|
||||||
#include <gdk/gdkwin32.h>
|
#include <gdk/gdkwin32.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
// use the file associations to open files instead of builtin Gtk editor
|
|
||||||
bool g_TextEditor_useWin32Editor = false;
|
|
||||||
#else
|
|
||||||
// custom shader editor
|
|
||||||
bool g_TextEditor_useCustomEditor = false;
|
|
||||||
CopiedString g_TextEditor_editorCommand( "" );
|
CopiedString g_TextEditor_editorCommand( "" );
|
||||||
#endif
|
|
||||||
|
|
||||||
void DoTextEditor( const char* filename, int cursorpos, int length ){
|
void DoTextEditor( const char* filename, int cursorpos, int length, bool external_editor ){
|
||||||
|
//StringOutputStream paths[4]( 256 );
|
||||||
|
StringOutputStream paths[4] = { StringOutputStream(256) };
|
||||||
|
StringOutputStream* goodpath = 0;
|
||||||
|
|
||||||
|
const char* gamename = GlobalRadiant().getGameName();
|
||||||
|
const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
|
||||||
|
const char* enginePath = GlobalRadiant().getEnginePath();
|
||||||
|
const char* homeEnginePath = g_qeglobals.m_userEnginePath.c_str();
|
||||||
|
|
||||||
|
paths[0] << homeEnginePath << gamename << '/' << filename;
|
||||||
|
paths[1] << enginePath << gamename << '/' << filename;
|
||||||
|
paths[2] << homeEnginePath << basegame << '/' << filename;
|
||||||
|
paths[3] << enginePath << basegame << '/' << filename;
|
||||||
|
|
||||||
|
for ( std::size_t i = 0; i < 4; ++i ){
|
||||||
|
if ( file_exists( paths[i].c_str() ) ){
|
||||||
|
goodpath = &paths[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( goodpath ){
|
||||||
|
globalOutputStream() << "opening file '" << goodpath->c_str() << "' (line " << cursorpos << " info ignored)\n";
|
||||||
|
if( external_editor ){
|
||||||
|
if( g_TextEditor_editorCommand.empty() ){
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if ( g_TextEditor_useWin32Editor ) {
|
ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), 0, goodpath->c_str(), 0, 0, SW_SHOWNORMAL );
|
||||||
StringOutputStream path( 256 );
|
// SHELLEXECUTEINFO ShExecInfo;
|
||||||
StringOutputStream modpath( 256 );
|
// ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||||
const char* gamename = GlobalRadiant().getGameName();
|
// ShExecInfo.fMask = 0;
|
||||||
const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
|
// ShExecInfo.hwnd = (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window );
|
||||||
const char* enginePath = GlobalRadiant().getEnginePath();
|
// ShExecInfo.lpVerb = NULL;
|
||||||
path << enginePath << basegame << '/' << filename;
|
// ShExecInfo.lpFile = goodpath->c_str();
|
||||||
modpath << enginePath << gamename << '/' << filename;
|
// ShExecInfo.lpParameters = NULL;
|
||||||
if ( file_exists( modpath.c_str() ) ){
|
// ShExecInfo.lpDirectory = NULL;
|
||||||
globalOutputStream() << "opening file '" << modpath.c_str() << "' (line " << cursorpos << " info ignored)\n";
|
// ShExecInfo.nShow = SW_SHOWNORMAL;
|
||||||
ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", modpath.c_str(), 0, 0, SW_SHOW );
|
// ShExecInfo.hInstApp = NULL;
|
||||||
}
|
// ShellExecuteEx(&ShExecInfo);
|
||||||
else if ( file_exists( path.c_str() ) ){
|
|
||||||
globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
|
|
||||||
ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", path.c_str(), 0, 0, SW_SHOW );
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
StringOutputStream path( 256 );
|
|
||||||
StringOutputStream modpath( 256 );
|
|
||||||
const char* gamename = GlobalRadiant().getGameName();
|
|
||||||
const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
|
|
||||||
const char* enginePath = GlobalRadiant().getEnginePath();
|
|
||||||
path << enginePath << basegame << '/' << filename;
|
|
||||||
modpath << enginePath << gamename << '/' << filename;
|
|
||||||
if ( file_exists( modpath.c_str() ) ){
|
|
||||||
globalOutputStream() << "opening file '" << modpath.c_str() << "' (line " << cursorpos << " info ignored)\n";
|
|
||||||
DoGtkTextEditor( modpath.c_str(), cursorpos, length );
|
|
||||||
}
|
|
||||||
else if ( file_exists( path.c_str() ) ){
|
|
||||||
globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
|
|
||||||
DoGtkTextEditor( path.c_str(), cursorpos, length );
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
// check if a custom editor is set
|
globalOutputStream() << "Failed to open '" << goodpath->c_str() << "'\nSet Shader Editor Command in preferences\n";
|
||||||
if ( g_TextEditor_useCustomEditor && !g_TextEditor_editorCommand.empty() ) {
|
#endif
|
||||||
|
}
|
||||||
|
else{
|
||||||
StringOutputStream strEditCommand( 256 );
|
StringOutputStream strEditCommand( 256 );
|
||||||
strEditCommand << g_TextEditor_editorCommand.c_str() << " \"" << filename << "\"";
|
strEditCommand << g_TextEditor_editorCommand.c_str() << " \"" << goodpath->c_str() << "\"";
|
||||||
|
|
||||||
globalOutputStream() << "Launching: " << strEditCommand.c_str() << "\n";
|
globalOutputStream() << "Launching: " << strEditCommand.c_str() << "\n";
|
||||||
// note: linux does not return false if the command failed so it will assume success
|
// note: linux does not return false if the command failed so it will assume success
|
||||||
if ( Q_Exec( 0, const_cast<char*>( strEditCommand.c_str() ), 0, true, false ) == false ) {
|
if ( Q_Exec( 0, const_cast<char*>( strEditCommand.c_str() ), 0, true, false ) == false ) {
|
||||||
globalOutputStream() << "Failed to execute " << strEditCommand.c_str() << ", using default\n";
|
globalOutputStream() << "Failed to execute " << strEditCommand.c_str() << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1158,7 +1148,12 @@ void DoTextEditor( const char* filename, int cursorpos, int length ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
DoGtkTextEditor( filename, cursorpos, length );
|
else{
|
||||||
#endif
|
DoGtkTextEditor( goodpath->c_str(), cursorpos, length );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity );
|
||||||
EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, char* title );
|
EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, char* title );
|
||||||
EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char* title );
|
EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char* title );
|
||||||
EMessageBoxReturn DoTextureLayout( float *fx, float *fy );
|
EMessageBoxReturn DoTextureLayout( float *fx, float *fy );
|
||||||
void DoTextEditor( const char* filename, int cursorpos, int length );
|
void DoTextEditor( const char* filename, int cursorpos, int length, bool external_editor );
|
||||||
|
|
||||||
void DoProjectSettings();
|
void DoProjectSettings();
|
||||||
|
|
||||||
|
|
@ -47,13 +47,8 @@ void DoSides( int type, int axis );
|
||||||
void DoAbout();
|
void DoAbout();
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
extern bool g_TextEditor_useWin32Editor;
|
|
||||||
#else
|
|
||||||
#include "string/stringfwd.h"
|
#include "string/stringfwd.h"
|
||||||
extern bool g_TextEditor_useCustomEditor;
|
|
||||||
extern CopiedString g_TextEditor_editorCommand;
|
extern CopiedString g_TextEditor_editorCommand;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -70,15 +70,7 @@ void Global_constructPreferences( PreferencesPage& page ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interface_constructPreferences( PreferencesPage& page ){
|
void Interface_constructPreferences( PreferencesPage& page ){
|
||||||
#ifdef WIN32
|
page.appendPathEntry( "Shader Editor Command", g_TextEditor_editorCommand, false );
|
||||||
page.appendCheckBox( "", "External Shader Editor", g_TextEditor_useWin32Editor );
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
GtkWidget* use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
|
|
||||||
GtkWidget* custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
|
|
||||||
Widget_connectToggleDependency( custom_editor, use_custom );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse_constructPreferences( PreferencesPage& page ){
|
void Mouse_constructPreferences( PreferencesPage& page ){
|
||||||
|
|
@ -87,7 +79,7 @@ void Mouse_constructPreferences( PreferencesPage& page ){
|
||||||
// page.appendRadio( "Mouse Type", g_glwindow_globals.m_nMouseType, STRING_ARRAY_RANGE( buttons ) );
|
// page.appendRadio( "Mouse Type", g_glwindow_globals.m_nMouseType, STRING_ARRAY_RANGE( buttons ) );
|
||||||
// }
|
// }
|
||||||
// page.appendCheckBox( "Right Button", "Activates Context Menu", g_xywindow_globals.m_bRightClick );
|
// page.appendCheckBox( "Right Button", "Activates Context Menu", g_xywindow_globals.m_bRightClick );
|
||||||
page.appendCheckBox( "", "Improved mousewheel zoom", g_xywindow_globals.m_bImprovedWheelZoom );
|
page.appendCheckBox( "", "Zoom to mouse pointer", g_xywindow_globals.m_bZoomInToPointer );
|
||||||
}
|
}
|
||||||
void Mouse_constructPage( PreferenceGroup& group ){
|
void Mouse_constructPage( PreferenceGroup& group ){
|
||||||
PreferencesPage page( group.createPage( "Mouse", "Mouse Preferences" ) );
|
PreferencesPage page( group.createPage( "Mouse", "Mouse Preferences" ) );
|
||||||
|
|
@ -702,7 +694,7 @@ PreferencesPage createPage( const char* treeName, const char* frameName ){
|
||||||
|
|
||||||
GtkWindow* PrefsDlg::BuildDialog(){
|
GtkWindow* PrefsDlg::BuildDialog(){
|
||||||
PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, Interface_constructPreferences>() );
|
PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, Interface_constructPreferences>() );
|
||||||
Mouse_registerPreferencesPage();
|
//Mouse_registerPreferencesPage();
|
||||||
|
|
||||||
GtkWindow* dialog = create_floating_window( "NetRadiant Preferences", m_parent );
|
GtkWindow* dialog = create_floating_window( "NetRadiant Preferences", m_parent );
|
||||||
|
|
||||||
|
|
@ -972,12 +964,7 @@ typedef FreeCaller1<const StringImportCallback&, GameMode_exportString> GameMode
|
||||||
|
|
||||||
|
|
||||||
void RegisterPreferences( PreferenceSystem& preferences ){
|
void RegisterPreferences( PreferenceSystem& preferences ){
|
||||||
#ifdef WIN32
|
|
||||||
preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useWin32Editor ), BoolExportStringCaller( g_TextEditor_useWin32Editor ) );
|
|
||||||
#else
|
|
||||||
preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useCustomEditor ), BoolExportStringCaller( g_TextEditor_useCustomEditor ) );
|
|
||||||
preferences.registerPreference( "CustomShaderEditorCommand", CopiedStringImportStringCaller( g_TextEditor_editorCommand ), CopiedStringExportStringCaller( g_TextEditor_editorCommand ) );
|
preferences.registerPreference( "CustomShaderEditorCommand", CopiedStringImportStringCaller( g_TextEditor_editorCommand ), CopiedStringExportStringCaller( g_TextEditor_editorCommand ) );
|
||||||
#endif
|
|
||||||
|
|
||||||
preferences.registerPreference( "GameName", GameNameImportStringCaller(), GameNameExportStringCaller() );
|
preferences.registerPreference( "GameName", GameNameImportStringCaller(), GameNameExportStringCaller() );
|
||||||
preferences.registerPreference( "GameMode", GameModeImportStringCaller(), GameModeExportStringCaller() );
|
preferences.registerPreference( "GameMode", GameModeImportStringCaller(), GameModeExportStringCaller() );
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "gtkdlgs.h"
|
#include "gtkdlgs.h"
|
||||||
|
|
||||||
void ViewShader( const char *pFile, const char *pName ){
|
void ViewShader( const char *pFile, const char *pName, bool external_editor ){
|
||||||
char* pBuff = 0;
|
char* pBuff = 0;
|
||||||
//int nSize =
|
//int nSize =
|
||||||
vfsLoadFile( pFile, reinterpret_cast<void**>( &pBuff ) );
|
vfsLoadFile( pFile, reinterpret_cast<void**>( &pBuff ) );
|
||||||
|
|
@ -123,5 +123,5 @@ void ViewShader( const char *pFile, const char *pName ){
|
||||||
// now close the file
|
// now close the file
|
||||||
vfsFreeFile( pBuff );
|
vfsFreeFile( pBuff );
|
||||||
|
|
||||||
DoTextEditor( pFile, static_cast<int>( nOffset ), length );
|
DoTextEditor( pFile, static_cast<int>( nOffset ), length, external_editor );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@
|
||||||
#if !defined( INCLUDED_SHADERS_H )
|
#if !defined( INCLUDED_SHADERS_H )
|
||||||
#define INCLUDED_SHADERS_H
|
#define INCLUDED_SHADERS_H
|
||||||
|
|
||||||
void ViewShader( const char* file, const char* shader );
|
void ViewShader( const char* file, const char* shader, bool external_editor );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -973,19 +973,10 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
|
||||||
By mouse click
|
By mouse click
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void SelectTexture( TextureBrowser& textureBrowser, int mx, int my, bool bShift ){
|
void SelectTexture( TextureBrowser& textureBrowser, int mx, int my, guint32 flags ){
|
||||||
|
if ( ( flags & GDK_SHIFT_MASK ) == 0 ) {
|
||||||
IShader* shader = Texture_At( textureBrowser, mx, my );
|
IShader* shader = Texture_At( textureBrowser, mx, my );
|
||||||
if ( shader != 0 ) {
|
if ( shader != 0 ) {
|
||||||
if ( bShift ) {
|
|
||||||
if ( shader->IsDefault() ) {
|
|
||||||
globalOutputStream() << "ERROR: " << shader->getName() << " is not a shader, it's a texture.\n";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ViewShader( shader->getShaderFileName(), shader->getName() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TextureBrowser_SetSelectedShader( textureBrowser, shader->getName() );
|
TextureBrowser_SetSelectedShader( textureBrowser, shader->getName() );
|
||||||
TextureBrowser_textureSelected( shader->getName() );
|
TextureBrowser_textureSelected( shader->getName() );
|
||||||
|
|
||||||
|
|
@ -1034,7 +1025,21 @@ void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureBrowser_Selection_MouseDown( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){
|
void TextureBrowser_Selection_MouseDown( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){
|
||||||
SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, ( flags & GDK_SHIFT_MASK ) != 0 );
|
SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureBrowser_Selection_MouseUp( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){
|
||||||
|
if ( ( flags & GDK_SHIFT_MASK ) != 0 ) {
|
||||||
|
IShader* shader = Texture_At( textureBrowser, pointx, textureBrowser.height - 1 - pointy );
|
||||||
|
if ( shader != 0 ) {
|
||||||
|
if ( shader->IsDefault() ) {
|
||||||
|
globalOutputStream() << "ERROR: " << shader->getName() << " is not a shader, it's a texture.\n";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ViewShader( shader->getShaderFileName(), shader->getName(), ( flags & GDK_CONTROL_MASK ) != 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1434,6 +1439,9 @@ gboolean TextureBrowser_button_release( GtkWidget* widget, GdkEventButton* event
|
||||||
TextureBrowser_Tracking_MouseUp( *textureBrowser );
|
TextureBrowser_Tracking_MouseUp( *textureBrowser );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( event->button == 1 ) {
|
||||||
|
TextureBrowser_Selection_MouseUp( *textureBrowser, event->state, static_cast<int>( event->x ), static_cast<int>( event->y ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,9 @@ void ClipPoint::Draw( const char *label, float scale ){
|
||||||
|
|
||||||
// draw label
|
// draw label
|
||||||
glRasterPos3f( m_ptClip[0] + offset, m_ptClip[1] + offset, m_ptClip[2] + offset );
|
glRasterPos3f( m_ptClip[0] + offset, m_ptClip[1] + offset, m_ptClip[2] + offset );
|
||||||
glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, label );
|
//glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, label ); //fails with GCC
|
||||||
|
//glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, reinterpret_cast<const GLubyte*>( label ) ); //worx
|
||||||
|
GlobalOpenGL().drawString( label );
|
||||||
}
|
}
|
||||||
|
|
||||||
float fDiff( float f1, float f2 ){
|
float fDiff( float f1, float f2 ){
|
||||||
|
|
@ -537,7 +539,7 @@ void XYWnd::ZoomOut(){
|
||||||
void XYWnd::ZoomInWithMouse( int pointx, int pointy ){
|
void XYWnd::ZoomInWithMouse( int pointx, int pointy ){
|
||||||
float old_scale = Scale();
|
float old_scale = Scale();
|
||||||
ZoomIn();
|
ZoomIn();
|
||||||
if ( g_xywindow_globals.m_bImprovedWheelZoom ) {
|
if ( g_xywindow_globals.m_bZoomInToPointer ) {
|
||||||
float scale_diff = 1.0 / old_scale - 1.0 / Scale();
|
float scale_diff = 1.0 / old_scale - 1.0 / Scale();
|
||||||
int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
|
int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
|
||||||
int nDim2 = ( m_viewType == XY ) ? 1 : 2;
|
int nDim2 = ( m_viewType == XY ) ? 1 : 2;
|
||||||
|
|
@ -982,15 +984,31 @@ void XYWnd::Clipper_OnMouseMoved( int x, int y ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#include "gtkutil/image.h"
|
||||||
|
|
||||||
|
/* is called on every mouse move fraction; ain't good! */
|
||||||
void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
|
void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
|
||||||
Vector3 mousePosition;
|
Vector3 mousePosition;
|
||||||
XY_ToPoint( x, y, mousePosition );
|
XY_ToPoint( x, y, mousePosition );
|
||||||
if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) {
|
if ( ClipMode() ) {
|
||||||
|
if( GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ){
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
cursor = gdk_cursor_new( GDK_CROSSHAIR );
|
cursor = gdk_cursor_new( GDK_CROSSHAIR );
|
||||||
|
//cursor = gdk_cursor_new( GDK_FLEUR );
|
||||||
gdk_window_set_cursor( m_gl_widget->window, cursor );
|
gdk_window_set_cursor( m_gl_widget->window, cursor );
|
||||||
gdk_cursor_unref( cursor );
|
gdk_cursor_unref( cursor );
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
GdkCursor *cursor;
|
||||||
|
cursor = gdk_cursor_new( GDK_HAND2 );
|
||||||
|
// GdkPixbuf* pixbuf = pixbuf_new_from_file_with_mask( "bitmaps/icon.png" );
|
||||||
|
// cursor = gdk_cursor_new_from_pixbuf( gdk_display_get_default(), pixbuf, 0, 0 );
|
||||||
|
// g_object_unref( pixbuf );
|
||||||
|
gdk_window_set_cursor( m_gl_widget->window, cursor );
|
||||||
|
gdk_cursor_unref( cursor );
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdk_window_set_cursor( m_gl_widget->window, 0 );
|
gdk_window_set_cursor( m_gl_widget->window, 0 );
|
||||||
|
|
@ -1285,6 +1303,8 @@ unsigned int Zoom_buttons(){
|
||||||
}
|
}
|
||||||
|
|
||||||
int g_dragZoom = 0;
|
int g_dragZoom = 0;
|
||||||
|
int g_zoom2x = 0;
|
||||||
|
int g_zoom2y = 0;
|
||||||
|
|
||||||
void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
|
void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
|
||||||
if ( y != 0 ) {
|
if ( y != 0 ) {
|
||||||
|
|
@ -1297,7 +1317,12 @@ void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ( g_xywindow_globals.m_bZoomInToPointer ) {
|
||||||
|
reinterpret_cast<XYWnd*>( data )->ZoomInWithMouse( g_zoom2x, g_zoom2y );
|
||||||
|
}
|
||||||
|
else{
|
||||||
reinterpret_cast<XYWnd*>( data )->ZoomIn();
|
reinterpret_cast<XYWnd*>( data )->ZoomIn();
|
||||||
|
}
|
||||||
g_dragZoom += 8;
|
g_dragZoom += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1309,12 +1334,14 @@ gboolean XYWnd_Zoom_focusOut( GtkWidget* widget, GdkEventFocus* event, XYWnd* xy
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XYWnd::Zoom_Begin(){
|
void XYWnd::Zoom_Begin( int x, int y ){
|
||||||
if ( m_zoom_started ) {
|
if ( m_zoom_started ) {
|
||||||
Zoom_End();
|
Zoom_End();
|
||||||
}
|
}
|
||||||
m_zoom_started = true;
|
m_zoom_started = true;
|
||||||
g_dragZoom = 0;
|
g_dragZoom = 0;
|
||||||
|
g_zoom2x = x;
|
||||||
|
g_zoom2y = y;
|
||||||
g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
|
g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
|
||||||
m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
|
m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
|
||||||
}
|
}
|
||||||
|
|
@ -1361,7 +1388,7 @@ void XYWnd::XY_MouseDown( int x, int y, unsigned int buttons ){
|
||||||
EntityCreate_MouseDown( x, y );
|
EntityCreate_MouseDown( x, y );
|
||||||
}
|
}
|
||||||
else if ( buttons == Zoom_buttons() ) {
|
else if ( buttons == Zoom_buttons() ) {
|
||||||
Zoom_Begin();
|
Zoom_Begin( x, y );
|
||||||
}
|
}
|
||||||
else if ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) {
|
else if ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) {
|
||||||
Clipper_OnLButtonDown( x, y );
|
Clipper_OnLButtonDown( x, y );
|
||||||
|
|
@ -2983,6 +3010,7 @@ void Orthographic_constructPreferences( PreferencesPage& page ){
|
||||||
//page.appendCheckBox( "", "Display size info", g_xywindow_globals_private.m_bSizePaint );
|
//page.appendCheckBox( "", "Display size info", g_xywindow_globals_private.m_bSizePaint );
|
||||||
page.appendCheckBox( "", "Chase mouse during drags", g_xywindow_globals_private.m_bChaseMouse );
|
page.appendCheckBox( "", "Chase mouse during drags", g_xywindow_globals_private.m_bChaseMouse );
|
||||||
// page.appendCheckBox( "", "Update views on camera move", g_xywindow_globals_private.m_bCamXYUpdate );
|
// page.appendCheckBox( "", "Update views on camera move", g_xywindow_globals_private.m_bCamXYUpdate );
|
||||||
|
page.appendCheckBox( "", "Zoom In to Mouse pointer", g_xywindow_globals.m_bZoomInToPointer );
|
||||||
}
|
}
|
||||||
void Orthographic_constructPage( PreferenceGroup& group ){
|
void Orthographic_constructPage( PreferenceGroup& group ){
|
||||||
PreferencesPage page( group.createPage( "Orthographic", "Orthographic View Preferences" ) );
|
PreferencesPage page( group.createPage( "Orthographic", "Orthographic View Preferences" ) );
|
||||||
|
|
@ -3040,7 +3068,7 @@ void XYWindow_Construct(){
|
||||||
GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );
|
GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );
|
||||||
|
|
||||||
// GlobalPreferenceSystem().registerPreference( "NewRightClick", BoolImportStringCaller( g_xywindow_globals.m_bRightClick ), BoolExportStringCaller( g_xywindow_globals.m_bRightClick ) );
|
// GlobalPreferenceSystem().registerPreference( "NewRightClick", BoolImportStringCaller( g_xywindow_globals.m_bRightClick ), BoolExportStringCaller( g_xywindow_globals.m_bRightClick ) );
|
||||||
GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", BoolImportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ), BoolExportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ) );
|
GlobalPreferenceSystem().registerPreference( "2DZoomInToPointer", BoolImportStringCaller( g_xywindow_globals.m_bZoomInToPointer ), BoolExportStringCaller( g_xywindow_globals.m_bZoomInToPointer ) );
|
||||||
GlobalPreferenceSystem().registerPreference( "ChaseMouse", BoolImportStringCaller( g_xywindow_globals_private.m_bChaseMouse ), BoolExportStringCaller( g_xywindow_globals_private.m_bChaseMouse ) );
|
GlobalPreferenceSystem().registerPreference( "ChaseMouse", BoolImportStringCaller( g_xywindow_globals_private.m_bChaseMouse ), BoolExportStringCaller( g_xywindow_globals_private.m_bChaseMouse ) );
|
||||||
GlobalPreferenceSystem().registerPreference( "SizePainting", BoolImportStringCaller( g_xywindow_globals_private.m_bSizePaint ), BoolExportStringCaller( g_xywindow_globals_private.m_bSizePaint ) );
|
GlobalPreferenceSystem().registerPreference( "SizePainting", BoolImportStringCaller( g_xywindow_globals_private.m_bSizePaint ), BoolExportStringCaller( g_xywindow_globals_private.m_bSizePaint ) );
|
||||||
GlobalPreferenceSystem().registerPreference( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) );
|
GlobalPreferenceSystem().registerPreference( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) );
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ void Move_End();
|
||||||
bool m_move_started;
|
bool m_move_started;
|
||||||
guint m_move_focusOut;
|
guint m_move_focusOut;
|
||||||
|
|
||||||
void Zoom_Begin();
|
void Zoom_Begin( int x, int y );
|
||||||
void Zoom_End();
|
void Zoom_End();
|
||||||
bool m_zoom_started;
|
bool m_zoom_started;
|
||||||
guint m_zoom_focusOut;
|
guint m_zoom_focusOut;
|
||||||
|
|
@ -269,7 +269,7 @@ struct xywindow_globals_t
|
||||||
|
|
||||||
// bool m_bRightClick;
|
// bool m_bRightClick;
|
||||||
bool m_bNoStipple;
|
bool m_bNoStipple;
|
||||||
bool m_bImprovedWheelZoom;
|
bool m_bZoomInToPointer;
|
||||||
|
|
||||||
xywindow_globals_t() :
|
xywindow_globals_t() :
|
||||||
color_gridback( 0.77f, 0.77f, 0.77f ),
|
color_gridback( 0.77f, 0.77f, 0.77f ),
|
||||||
|
|
@ -287,7 +287,7 @@ struct xywindow_globals_t
|
||||||
AxisColorZ( 0.f, 0.f, 1.f ),
|
AxisColorZ( 0.f, 0.f, 1.f ),
|
||||||
// m_bRightClick( true ),
|
// m_bRightClick( true ),
|
||||||
m_bNoStipple( true ),
|
m_bNoStipple( true ),
|
||||||
m_bImprovedWheelZoom( true ){
|
m_bZoomInToPointer( true ){
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1596,6 +1596,7 @@ int ShiftBSPMain( int argc, char **argv ){
|
||||||
{
|
{
|
||||||
//find point on plane
|
//find point on plane
|
||||||
for ( j=0; j<3; j++ ){
|
for ( j=0; j<3; j++ ){
|
||||||
|
//point[j] = bspPlanes[ i ].dist * bspPlanes[ i ].normal[j];
|
||||||
if ( fabs( bspPlanes[ i ].normal[j] ) > 0.5 ){
|
if ( fabs( bspPlanes[ i ].normal[j] ) > 0.5 ){
|
||||||
point[j] = bspPlanes[ i ].dist / bspPlanes[ i ].normal[j];
|
point[j] = bspPlanes[ i ].dist / bspPlanes[ i ].normal[j];
|
||||||
point[(j+1)%3] = point[(j+2)%3] = 0;
|
point[(j+1)%3] = point[(j+2)%3] = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user