From: Thomas Debesse Date: Mon, 11 Feb 2019 14:06:35 +0000 (+0100) Subject: Merge commit '0fb65a91c7530dc2215dddd13e7accf059c6f453' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=650279d27dcea9bf35dc01eb17531e8c661aa3fa;p=xonotic%2Fnetradiant.git Merge commit '0fb65a91c7530dc2215dddd13e7accf059c6f453' into garux-merge --- 650279d27dcea9bf35dc01eb17531e8c661aa3fa diff --cc libs/gtkutil/accelerator.cpp index 414a8eac,c49c2c70..00380d45 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@@ -350,12 -363,14 +350,14 @@@ void Keys_releaseAll( PressedKeys::Keys keys.clear(); } -gboolean PressedKeys_key_press( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){ +gboolean PressedKeys_key_press(ui::Widget widget, GdkEventKey* event, PressedKeys* pressedKeys ){ //globalOutputStream() << "pressed: " << event->keyval << "\n"; - return event->state == 0 && Keys_press( pressedKeys->keys, event->keyval ); + //return event->state == 0 && Keys_press( pressedKeys->keys, event->keyval ); + //NumLock perspective window fix + return ( event->state & ALLOWED_MODIFIERS ) == 0 && Keys_press( pressedKeys->keys, event->keyval ); } -gboolean PressedKeys_key_release( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){ +gboolean PressedKeys_key_release(ui::Widget widget, GdkEventKey* event, PressedKeys* pressedKeys ){ //globalOutputStream() << "released: " << event->keyval << "\n"; return Keys_release( pressedKeys->keys, event->keyval ); } diff --cc radiant/brushmanip.cpp index d73450a5,acb83822..3d8adae9 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@@ -1308,8 -1432,7 +1308,8 @@@ void Brush_constructMenu( ui::Menu men if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu_in_menu ); } - create_menu_item_with_mnemonic( menu_in_menu, "Make _Hollow", "CSGMakeHollow" ); - create_menu_item_with_mnemonic( menu_in_menu, "Make _Room", "CSGMakeRoom" ); + create_menu_item_with_mnemonic( menu_in_menu, "Make _Hollow", "CSGHollow" ); ++ create_menu_item_with_mnemonic( menu_in_menu, "Make _Room", "CSGRoom" ); create_menu_item_with_mnemonic( menu_in_menu, "CSG _Subtract", "CSGSubtract" ); create_menu_item_with_mnemonic( menu_in_menu, "CSG _Merge", "CSGMerge" ); } diff --cc radiant/camwindow.cpp index f34e40e0,f657551b..447d2341 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@@ -1665,8 -1663,8 +1665,8 @@@ void Camera_ToggleFarClip() } -void CamWnd_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_toggle_button( toolbar, "Cubic clip the camera view (Ctrl + \\)", "view_cubicclipping.bmp", "ToggleCubicClip" ); +void CamWnd_constructToolbar( ui::Toolbar toolbar ){ - toolbar_append_toggle_button( toolbar, "Cubic clip the camera view (\\)", "view_cubicclipping.png", "ToggleCubicClip" ); ++ toolbar_append_toggle_button( toolbar, "Cubic clip the camera view (Ctrl + \\)", "view_cubicclipping.png", "ToggleCubicClip" ); } void CamWnd_registerShortcuts(){ diff --cc radiant/entityinspector.cpp index e74dd3f0,407aaa1a..d2acdc80 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@@ -1268,8 -1302,19 +1285,18 @@@ static gint EntityEntry_keypress( ui::E } return TRUE; } - if ( event->keyval == GDK_KEY_Escape ) { - gtk_window_set_focus( widget.window(), NULL ); + if ( event->keyval == GDK_Tab ) { - if ( widget == g_entityKeyEntry ) { - gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) ); ++ if ( widget._handle == g_entityKeyEntry._handle ) { ++ gtk_window_set_focus( widget.window(), g_entityValueEntry ); + } + else + { - gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) ); ++ gtk_window_set_focus( widget.window(), g_entityKeyEntry ); + } + return TRUE; + } + if ( event->keyval == GDK_Escape ) { - //gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL ); - GroupDialog_showPage( g_page_entity ); ++ // gtk_window_set_focus( widget.window(), NULL ); return TRUE; } @@@ -1284,17 -1329,32 +1311,32 @@@ void EntityInspector_destroyWindow( ui: GlobalEntityAttributes_clear(); } + static gint EntityInspector_destroyWindowKB( 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 ); + return TRUE; + } + if ( event->keyval == GDK_Tab ) { + gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) ); + return TRUE; + } + return FALSE; + } + -GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ - GtkWidget* vbox = gtk_vbox_new( FALSE, 2 ); - gtk_widget_show( vbox ); +ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ + auto vbox = ui::VBox( FALSE, 2 ); + 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( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 ); + vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 ); { - GtkWidget* split1 = gtk_vpaned_new(); - gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 ); - gtk_widget_show( split1 ); + auto split1 = ui::VPaned(ui::New); + vbox.pack_start( split1, TRUE, TRUE, 0 ); + split1.show(); g_entity_split1 = split1; @@@ -1398,16 -1458,17 +1440,17 @@@ gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); { - GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ); + ui::ListStore store = ui::ListStore::from(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING )); - GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ); - gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE ); - gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); + auto view = ui::TreeView(ui::TreeModel::from(store._handle)); + gtk_tree_view_set_enable_search(view, FALSE ); + gtk_tree_view_set_headers_visible(view, FALSE ); + g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityInspector_clearKeyValueKB ), 0 ); { - GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); - GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 ); - gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); + auto renderer = ui::CellRendererText(ui::New); + auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); + gtk_tree_view_append_column(view, column ); } { diff --cc radiant/mainframe.cpp index f3e71af4,4f0bfef0..50101b3f --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -2429,57 -2286,57 +2429,57 @@@ void register_shortcuts() SelectByType_registerShortcuts(); } -void File_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "Open an existing map (CTRL + O)", "file_open.bmp", "OpenMap" ); - toolbar_append_button( toolbar, "Save the active map (CTRL + S)", "file_save.bmp", "SaveMap" ); +void File_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "Open an existing map (CTRL + O)", "file_open.png", "OpenMap" ); + toolbar_append_button( toolbar, "Save the active map (CTRL + S)", "file_save.png", "SaveMap" ); } -void UndoRedo_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "Undo (CTRL + Z)", "undo.bmp", "Undo" ); - toolbar_append_button( toolbar, "Redo (CTRL + Y)", "redo.bmp", "Redo" ); +void UndoRedo_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "Undo (CTRL + Z)", "undo.png", "Undo" ); + toolbar_append_button( toolbar, "Redo (CTRL + Y)", "redo.png", "Redo" ); } -void RotateFlip_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "x-axis Flip", "brush_flipx.bmp", "MirrorSelectionX" ); - toolbar_append_button( toolbar, "x-axis Rotate", "brush_rotatex.bmp", "RotateSelectionX" ); - toolbar_append_button( toolbar, "y-axis Flip", "brush_flipy.bmp", "MirrorSelectionY" ); - toolbar_append_button( toolbar, "y-axis Rotate", "brush_rotatey.bmp", "RotateSelectionY" ); - toolbar_append_button( toolbar, "z-axis Flip", "brush_flipz.bmp", "MirrorSelectionZ" ); - toolbar_append_button( toolbar, "z-axis Rotate", "brush_rotatez.bmp", "RotateSelectionZ" ); +void RotateFlip_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "x-axis Flip", "brush_flipx.png", "MirrorSelectionX" ); + toolbar_append_button( toolbar, "x-axis Rotate", "brush_rotatex.png", "RotateSelectionX" ); + toolbar_append_button( toolbar, "y-axis Flip", "brush_flipy.png", "MirrorSelectionY" ); + toolbar_append_button( toolbar, "y-axis Rotate", "brush_rotatey.png", "RotateSelectionY" ); + toolbar_append_button( toolbar, "z-axis Flip", "brush_flipz.png", "MirrorSelectionZ" ); + toolbar_append_button( toolbar, "z-axis Rotate", "brush_rotatez.png", "RotateSelectionZ" ); } -void Select_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "Select touching", "selection_selecttouching.bmp", "SelectTouching" ); - toolbar_append_button( toolbar, "Select inside", "selection_selectinside.bmp", "SelectInside" ); +void Select_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "Select touching", "selection_selecttouching.png", "SelectTouching" ); + toolbar_append_button( toolbar, "Select inside", "selection_selectinside.png", "SelectInside" ); } -void CSG_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "CSG Subtract (SHIFT + U)", "selection_csgsubtract.bmp", "CSGSubtract" ); - toolbar_append_button( toolbar, "CSG Merge (CTRL + U)", "selection_csgmerge.bmp", "CSGMerge" ); - toolbar_append_button( toolbar, "Hollow", "selection_makehollow.bmp", "CSGHollow" ); - toolbar_append_button( toolbar, "Room", "selection_makeroom.bmp", "CSGroom" ); +void CSG_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "CSG Subtract (SHIFT + U)", "selection_csgsubtract.png", "CSGSubtract" ); + toolbar_append_button( toolbar, "CSG Merge (CTRL + U)", "selection_csgmerge.png", "CSGMerge" ); - toolbar_append_button( toolbar, "Make Hollow", "selection_makehollow.png", "CSGMakeHollow" ); - toolbar_append_button( toolbar, "Make Room", "selection_makeroom.png", "CSGMakeRoom" ); ++ toolbar_append_button( toolbar, "Make Hollow", "selection_makehollow.png", "CSGHollow" ); ++ toolbar_append_button( toolbar, "Make Room", "selection_makeroom.png", "CSGRoom" ); } -void ComponentModes_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_toggle_button( toolbar, "Select Vertices (V)", "modify_vertices.bmp", "DragVertices" ); - toolbar_append_toggle_button( toolbar, "Select Edges (E)", "modify_edges.bmp", "DragEdges" ); - toolbar_append_toggle_button( toolbar, "Select Faces (F)", "modify_faces.bmp", "DragFaces" ); +void ComponentModes_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_toggle_button( toolbar, "Select Vertices (V)", "modify_vertices.png", "DragVertices" ); + toolbar_append_toggle_button( toolbar, "Select Edges (E)", "modify_edges.png", "DragEdges" ); + toolbar_append_toggle_button( toolbar, "Select Faces (F)", "modify_faces.png", "DragFaces" ); } -void Clipper_constructToolbar( GtkToolbar* toolbar ){ +void Clipper_constructToolbar( ui::Toolbar toolbar ){ - toolbar_append_toggle_button( toolbar, "Clipper (X)", "view_clipper.bmp", "ToggleClipper" ); + toolbar_append_toggle_button( toolbar, "Clipper (X)", "view_clipper.png", "ToggleClipper" ); } -void XYWnd_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "Change views", "view_change.bmp", "NextView" ); +void XYWnd_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "Change views", "view_change.png", "NextView" ); } -void Manipulators_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_toggle_button( toolbar, "Translate (W)", "select_mousetranslate.bmp", "MouseTranslate" ); - toolbar_append_toggle_button( toolbar, "Rotate (R)", "select_mouserotate.bmp", "MouseRotate" ); - toolbar_append_toggle_button( toolbar, "Scale", "select_mousescale.bmp", "MouseScale" ); - toolbar_append_toggle_button( toolbar, "Resize (Q)", "select_mouseresize.bmp", "MouseDrag" ); +void Manipulators_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_toggle_button( toolbar, "Translate (W)", "select_mousetranslate.png", "MouseTranslate" ); + toolbar_append_toggle_button( toolbar, "Rotate (R)", "select_mouserotate.png", "MouseRotate" ); + toolbar_append_toggle_button( toolbar, "Scale", "select_mousescale.png", "MouseScale" ); + toolbar_append_toggle_button( toolbar, "Resize (Q)", "select_mouseresize.png", "MouseDrag" ); Clipper_constructToolbar( toolbar ); } @@@ -2994,42 -2842,35 +2994,37 @@@ void MainFrame::Create() if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) { { - ui::Widget vsplit = ui::VPaned(ui::New); - m_vSplit = vsplit; - vbox.pack_start( vsplit, TRUE, TRUE, 0 ); - vsplit.show(); - - // console - ui::Widget console_window = Console_constructWindow( window ); - gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE ); - - GtkWidget* hsplit = gtk_hpaned_new(); - m_hSplit = hsplit; - gtk_box_pack_start( GTK_BOX( vbox ), hsplit, TRUE, TRUE, 0 ); - gtk_widget_show( hsplit ); ++ ui::Widget hsplit = ui::HPaned(ui::New); ++ m_vSplit = hsplit; ++ vbox.pack_start( hsplit, TRUE, TRUE, 0 ); ++ hsplit.show(); { - ui::Widget hsplit = ui::HPaned(ui::New); - hsplit.show(); - m_hSplit = hsplit; - gtk_paned_add1( GTK_PANED( vsplit ), hsplit ); - GtkWidget* vsplit = gtk_vpaned_new(); - gtk_widget_show( vsplit ); ++ ui::Widget vsplit = ui::VPaned(ui::New); ++ vsplit.show(); + m_vSplit = vsplit; - GtkWidget* vsplit2 = gtk_vpaned_new(); - gtk_widget_show( vsplit2 ); - m_vSplit2 = vsplit2; ++ ui::Widget vsplit2 = ui::VPaned(ui::New); ++ vsplit2.show(); ++ m_vSplit = vsplit2; + if ( CurrentStyle() == eRegular ){ + gtk_paned_add1( GTK_PANED( hsplit ), vsplit ); + gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 ); + } + else{ + gtk_paned_add2( GTK_PANED( hsplit ), vsplit ); + gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 ); + } + + // console - GtkWidget* console_window = Console_constructWindow( window ); ++ ui::Widget console_window = Console_constructWindow( window ); + gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE ); - ++ // xy m_pXYWnd = new XYWnd(); m_pXYWnd->SetViewType( XY ); - GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) ); + ui::Widget xy_window = ui::Widget(create_framed_widget( m_pXYWnd->GetWidget( ) )); + + gtk_paned_add1( GTK_PANED( vsplit ), xy_window ); { - ui::Widget vsplit2 = ui::VPaned(ui::New); - vsplit2.show(); - m_vSplit2 = vsplit2; - - if ( CurrentStyle() == eRegular ) { - gtk_paned_add1( GTK_PANED( hsplit ), xy_window ); - gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 ); - } - else - { - gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 ); - gtk_paned_add2( GTK_PANED( hsplit ), xy_window ); - } - - // camera m_pCamWnd = NewCamWnd(); GlobalCamera_setCamWnd( *m_pCamWnd ); @@@ -3463,10 -3308,10 +3458,10 @@@ void MainFrame_Construct() GlobalCommands_insert( "ChooseOrthoViewNameColor", makeCallback( g_ColoursMenu.m_viewname ) ); - GlobalCommands_insert( "CSGSubtract", FreeCaller(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "CSGMerge", FreeCaller(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "CSGHollow", FreeCaller() ); - GlobalCommands_insert( "CSGroom", FreeCaller() ); + GlobalCommands_insert( "CSGSubtract", makeCallbackF(CSG_Subtract), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalCommands_insert( "CSGMerge", makeCallbackF(CSG_Merge), Accelerator( 'U', (GdkModifierType) GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "CSGMakeHollow", makeCallbackF(CSG_MakeHollow) ); - GlobalCommands_insert( "CSGMakeRoom", makeCallbackF(CSG_MakeRoom) ); ++ GlobalCommands_insert( "CSGHollow", makeCallbackF(CSG_MakeHollow) ); ++ GlobalCommands_insert( "CSGRoom", makeCallbackF(CSG_MakeRoom) ); Grid_registerCommands(); diff --cc radiant/select.cpp index c5a36947,4c9b30f9..eb2cacbd --- a/radiant/select.cpp +++ b/radiant/select.cpp @@@ -883,15 -885,18 +883,18 @@@ inline Quaternion quaternion_for_euler_ struct RotateDialog { - GtkSpinButton* x; - GtkSpinButton* y; - GtkSpinButton* z; - GtkWindow *window; + ui::SpinButton x{ui::null}; + ui::SpinButton y{ui::null}; + ui::SpinButton z{ui::null}; + ui::Window window{ui::null}; }; -static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog ){ +static gboolean rotatedlg_apply( ui::Widget widget, RotateDialog* rotateDialog ){ Vector3 eulerXYZ; + gtk_spin_button_update ( rotateDialog->x ); + gtk_spin_button_update ( rotateDialog->y ); + gtk_spin_button_update ( rotateDialog->z ); eulerXYZ[0] = static_cast( gtk_spin_button_get_value( rotateDialog->x ) ); eulerXYZ[1] = static_cast( gtk_spin_button_get_value( rotateDialog->y ) ); eulerXYZ[2] = static_cast( gtk_spin_button_get_value( rotateDialog->z ) ); @@@ -914,9 -919,10 +917,10 @@@ static gboolean rotatedlg_cancel( ui::W return TRUE; } -static gboolean rotatedlg_ok( GtkWidget *widget, RotateDialog* rotateDialog ){ +static gboolean rotatedlg_ok( ui::Widget widget, RotateDialog* rotateDialog ){ rotatedlg_apply( widget, rotateDialog ); + // rotatedlg_cancel( widget, rotateDialog ); - gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) ); + rotateDialog->window.hide(); return TRUE; } @@@ -1054,9 -1072,10 +1058,10 @@@ static gboolean scaledlg_cancel( ui::Wi return TRUE; } -static gboolean scaledlg_ok( GtkWidget *widget, ScaleDialog* scaleDialog ){ +static gboolean scaledlg_ok( ui::Widget widget, ScaleDialog* scaleDialog ){ scaledlg_apply( widget, scaleDialog ); + //scaledlg_cancel( widget, scaleDialog ); - gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) ); + scaleDialog->window.hide(); return TRUE; } diff --cc radiant/texwindow.cpp index 87094456,c7e02c11..45c684b2 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -174,7 -127,14 +174,8 @@@ typedef ReferenceCaller TextureGroupsAddDirectoryCaller; + -namespace -{ -bool g_TextureBrowser_shaderlistOnly = false; -bool g_TextureBrowser_fixedSize = true; -bool g_TextureBrowser_filterNotex = false; -} +typedef ReferenceCaller TextureGroupsAddDirectoryCaller; class DeferredAdjustment { @@@ -324,42 -264,78 +325,80 @@@ bool m_searchedTags bool m_tags; // The uniform size (in pixels) that textures are resized to when m_resizeTextures is true. int m_uniformTextureSize; + int m_uniformTextureMinSize; + // Return the display width of a texture in the texture browser - int getTextureWidth( qtexture_t* tex ){ - int width; + /*void getTextureWH( qtexture_t* tex, int *width, int *height ){ if ( !g_TextureBrowser_fixedSize ) { // Don't use uniform size - width = (int)( tex->width * ( (float)m_textureScale / 100 ) ); + *width = (int)( tex->width * ( (float)m_textureScale / 100 ) ); + *height = (int)( tex->height * ( (float)m_textureScale / 100 ) ); + } - else if - ( tex->width >= tex->height ) { + else if ( tex->width >= tex->height ) { // Texture is square, or wider than it is tall - width = m_uniformTextureSize; + if ( tex->width >= m_uniformTextureSize ){ + *width = m_uniformTextureSize; + *height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) ); + } + else if ( tex->width <= m_uniformTextureMinSize ){ + *width = m_uniformTextureMinSize; + *height = (int)( m_uniformTextureMinSize * ( (float)tex->height / tex->width ) ); + } + else { + *width = tex->width; + *height = tex->height; + } } else { - // Otherwise, preserve the texture's aspect ratio - width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) ); + // Texture taller than it is wide + if ( tex->height >= m_uniformTextureSize ){ + *height = m_uniformTextureSize; + *width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) ); + } + else if ( tex->height <= m_uniformTextureMinSize ){ + *height = m_uniformTextureMinSize; + *width = (int)( m_uniformTextureMinSize * ( (float)tex->width / tex->height ) ); + } + else { + *width = tex->width; + *height = tex->height; + } } - return width; } + - // Return the display height of a texture in the texture browser - int getTextureHeight( qtexture_t* tex ){ - int height; - if ( !g_TextureBrowser_fixedSize ) { + */ + void getTextureWH( qtexture_t* tex, int *width, int *height ){ // Don't use uniform size - height = (int)( tex->height * ( (float)m_textureScale / 100 ) ); - } - else if ( tex->height >= tex->width ) { - // Texture is square, or taller than it is wide - height = m_uniformTextureSize; - } - else { - // Otherwise, preserve the texture's aspect ratio - height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) ); + *width = (int)( tex->width * ( (float)m_textureScale / 100 ) ); + *height = (int)( tex->height * ( (float)m_textureScale / 100 ) ); + + if ( g_TextureBrowser_fixedSize ){ + int W = *width; + int H = *height; + if ( W >= H ) { + // Texture is square, or wider than it is tall + if ( W >= m_uniformTextureSize ){ + *width = m_uniformTextureSize; + *height = m_uniformTextureSize * H / W; + } + else if ( W <= m_uniformTextureMinSize ){ + *width = m_uniformTextureMinSize; + *height = m_uniformTextureMinSize * H / W; + } + } + else { + // Texture taller than it is wide + if ( H >= m_uniformTextureSize ){ + *height = m_uniformTextureSize; + *width = m_uniformTextureSize * W / H; + } + else if ( H <= m_uniformTextureMinSize ){ + *height = m_uniformTextureMinSize; + *width = m_uniformTextureMinSize * W / H; + } + } } - return height; } TextureBrowser() : @@@ -1320,6 -1216,10 +1362,11 @@@ void TextureBrowser_setUniformSize( Tex TextureBrowser_queueDraw( textureBrowser ); } + void TextureBrowser_setUniformMinSize( TextureBrowser& textureBrowser, std::size_t scale ){ + textureBrowser.m_uniformTextureMinSize = scale; ++ + TextureBrowser_queueDraw( textureBrowser ); + } void TextureBrowser_MouseWheel( TextureBrowser& textureBrowser, bool bUp ){ int originy = TextureBrowser_getOriginY( textureBrowser ); @@@ -2562,59 -2439,63 +2611,70 @@@ void TextureBrowser_exportTitle( const importer( buffer.c_str() ); } +struct TextureScale { + static void Export(const TextureBrowser &self, const Callback &returnz) { + switch (self.m_textureScale) { + case 10: + returnz(0); + break; + case 25: + returnz(1); + break; + case 50: + returnz(2); + break; + case 100: + returnz(3); + break; + case 200: + returnz(4); + break; + } + } + + static void Import(TextureBrowser &self, int value) { + switch (value) { + case 0: + TextureBrowser_setScale(self, 10); + break; + case 1: + TextureBrowser_setScale(self, 25); + break; + case 2: + TextureBrowser_setScale(self, 50); + break; + case 3: + TextureBrowser_setScale(self, 100); + break; + case 4: + TextureBrowser_setScale(self, 200); + break; + } + } +}; -void TextureScaleImport( TextureBrowser& textureBrowser, int value ){ - switch ( value ) - { - case 0: - TextureBrowser_setScale( textureBrowser, 10 ); - break; - case 1: - TextureBrowser_setScale( textureBrowser, 25 ); - break; - case 2: - TextureBrowser_setScale( textureBrowser, 50 ); - break; - case 3: - TextureBrowser_setScale( textureBrowser, 100 ); - break; - case 4: - TextureBrowser_setScale( textureBrowser, 200 ); - break; - } -} -typedef ReferenceCaller1 TextureScaleImportCaller; - -void TextureScaleExport( TextureBrowser& textureBrowser, const IntImportCallback& importer ){ - switch ( textureBrowser.m_textureScale ) - { - case 10: - importer( 0 ); - break; - case 25: - importer( 1 ); - break; - case 50: - importer( 2 ); - break; - case 100: - importer( 3 ); - break; - case 200: - importer( 4 ); - break; +struct UniformTextureSize { + static void Export(const TextureBrowser &self, const Callback &returnz) { + returnz(g_TextureBrowser.m_uniformTextureSize); } -} -typedef ReferenceCaller1 TextureScaleExportCaller; -void UniformTextureSizeImport( TextureBrowser& textureBrowser, int value ){ - if ( value >= 16 ) - TextureBrowser_setUniformSize( textureBrowser, value ); -} -typedef ReferenceCaller1 UniformTextureSizeImportCaller; + static void Import(TextureBrowser &self, int value) { + if (value > 16) + TextureBrowser_setUniformSize(self, value); + } +}; -void UniformTextureMinSizeImport( TextureBrowser& textureBrowser, int value ){ - if ( value >= 16 ) - TextureBrowser_setUniformMinSize( textureBrowser, value ); -} -typedef ReferenceCaller1 UniformTextureMinSizeImportCaller; ++struct UniformTextureMinSize { ++ static void Export(const TextureBrowser &self, const Callback &returnz) { ++ returnz(g_TextureBrowser.m_uniformTextureMinSize); ++ } ++ ++ static void Import(TextureBrowser &self, int value) { ++ if (value > 16) ++ TextureBrowser_setUniformSize(self, value); ++ } ++}; + void TextureBrowser_constructPreferences( PreferencesPage& page ){ page.appendCheckBox( "", "Texture scrollbar", @@@ -2625,21 -2507,18 +2685,18 @@@ page.appendCombo( "Texture Thumbnail Scale", STRING_ARRAY_RANGE( texture_scale ), - IntImportCallback( TextureScaleImportCaller( GlobalTextureBrowser() ) ), - IntExportCallback( TextureScaleExportCaller( GlobalTextureBrowser() ) ) + make_property(GlobalTextureBrowser()) ); } - page.appendSpinner( - "Texture Thumbnail Size", - GlobalTextureBrowser().m_uniformTextureSize, - GlobalTextureBrowser().m_uniformTextureSize, - 16, 8192 - ); + page.appendSpinner( "Thumbnails Max Size", GlobalTextureBrowser().m_uniformTextureSize, GlobalTextureBrowser().m_uniformTextureSize, 16, 8192 ); + page.appendSpinner( "Thumbnails Min Size", GlobalTextureBrowser().m_uniformTextureMinSize, GlobalTextureBrowser().m_uniformTextureMinSize, 16, 8192 ); page.appendEntry( "Mousewheel Increment", GlobalTextureBrowser().m_mouseWheelScrollIncrement ); { const char* startup_shaders[] = { "None", TextureBrowser_getComonShadersName() }; page.appendCombo( "Load Shaders at Startup", reinterpret_cast( GlobalTextureBrowser().m_startupShaders ), STRING_ARRAY_RANGE( startup_shaders ) ); } } ++ void TextureBrowser_constructPage( PreferenceGroup& group ){ PreferencesPage page( group.createPage( "Texture Browser", "Texture Browser Preferences" ) ); TextureBrowser_constructPreferences( page ); @@@ -2657,35 -2538,43 +2714,36 @@@ void TextureBrowser_registerPreferences void TextureClipboard_textureSelected( const char* shader ); void TextureBrowser_Construct(){ - GlobalCommands_insert( "ShaderInfo", FreeCaller() ); - GlobalCommands_insert( "ShowUntagged", FreeCaller() ); - GlobalCommands_insert( "AddTag", FreeCaller() ); - GlobalCommands_insert( "RenameTag", FreeCaller() ); - GlobalCommands_insert( "DeleteTag", FreeCaller() ); - GlobalCommands_insert( "CopyTag", FreeCaller() ); - GlobalCommands_insert( "PasteTag", FreeCaller() ); - GlobalCommands_insert( "RefreshShaders", FreeCaller() ); - GlobalToggles_insert( "ShowInUse", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) ); - GlobalCommands_insert( "ShowAllTextures", FreeCaller(), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "ToggleTextures", FreeCaller(), Accelerator( 'T' ) ); - GlobalToggles_insert( "ToggleShowShaders", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) ); - GlobalToggles_insert( "ToggleShowShaderlistOnly", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) ); - GlobalToggles_insert( "FixedSize", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) ); - GlobalToggles_insert( "FilterNotex", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) ); - - GlobalPreferenceSystem().registerPreference( "TextureScale", - makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ), - SizeExportStringCaller( g_TextureBrowser.m_textureScale ) - ); - GlobalPreferenceSystem().registerPreference( "UniformTextureSize", - makeIntStringImportCallback(UniformTextureSizeImportCaller(g_TextureBrowser)), - IntExportStringCaller(g_TextureBrowser.m_uniformTextureSize) ); - GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", - makeIntStringImportCallback(UniformTextureMinSizeImportCaller(g_TextureBrowser)), - IntExportStringCaller(g_TextureBrowser.m_uniformTextureMinSize) ); - GlobalPreferenceSystem().registerPreference( "TextureScrollbar", - makeBoolStringImportCallback( TextureBrowserImportShowScrollbarCaller( g_TextureBrowser ) ), - BoolExportStringCaller( GlobalTextureBrowser().m_showTextureScrollbar ) - ); - GlobalPreferenceSystem().registerPreference( "ShowShaders", BoolImportStringCaller( GlobalTextureBrowser().m_showShaders ), BoolExportStringCaller( GlobalTextureBrowser().m_showShaders ) ); - GlobalPreferenceSystem().registerPreference( "ShowShaderlistOnly", BoolImportStringCaller( g_TextureBrowser_shaderlistOnly ), BoolExportStringCaller( g_TextureBrowser_shaderlistOnly ) ); - GlobalPreferenceSystem().registerPreference( "FixedSize", BoolImportStringCaller( g_TextureBrowser_fixedSize ), BoolExportStringCaller( g_TextureBrowser_fixedSize ) ); - GlobalPreferenceSystem().registerPreference( "FilterNotex", BoolImportStringCaller( g_TextureBrowser_filterNotex ), BoolExportStringCaller( g_TextureBrowser_filterNotex ) ); - GlobalPreferenceSystem().registerPreference( "LoadShaders", IntImportStringCaller( reinterpret_cast( GlobalTextureBrowser().m_startupShaders ) ), IntExportStringCaller( reinterpret_cast( GlobalTextureBrowser().m_startupShaders ) ) ); - GlobalPreferenceSystem().registerPreference( "WheelMouseInc", SizeImportStringCaller( GlobalTextureBrowser().m_mouseWheelScrollIncrement ), SizeExportStringCaller( GlobalTextureBrowser().m_mouseWheelScrollIncrement ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors0", Vector3ImportStringCaller( GlobalTextureBrowser().color_textureback ), Vector3ExportStringCaller( GlobalTextureBrowser().color_textureback ) ); + GlobalCommands_insert( "ShaderInfo", makeCallbackF(TextureBrowser_shaderInfo) ); + GlobalCommands_insert( "ShowUntagged", makeCallbackF(TextureBrowser_showUntagged) ); + GlobalCommands_insert( "AddTag", makeCallbackF(TextureBrowser_addTag) ); + GlobalCommands_insert( "RenameTag", makeCallbackF(TextureBrowser_renameTag) ); + GlobalCommands_insert( "DeleteTag", makeCallbackF(TextureBrowser_deleteTag) ); + GlobalCommands_insert( "CopyTag", makeCallbackF(TextureBrowser_copyTag) ); + GlobalCommands_insert( "PasteTag", makeCallbackF(TextureBrowser_pasteTag) ); + GlobalCommands_insert( "RefreshShaders", makeCallbackF(VFS_Refresh) ); + GlobalToggles_insert( "ShowInUse", makeCallbackF(TextureBrowser_ToggleHideUnused), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) ); + GlobalCommands_insert( "ShowAllTextures", makeCallbackF(TextureBrowser_showAll), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "ToggleTextures", makeCallbackF(TextureBrowser_toggleShow), Accelerator( 'T' ) ); + GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) ); + GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) ); + GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) ); + GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) ); + GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hidenotex_item ) ); + GlobalToggles_insert( "EnableAlpha", makeCallbackF(TextureBrowser_EnableAlpha), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_enablealpha_item ) ); + + GlobalPreferenceSystem().registerPreference( "TextureScale", make_property_string(g_TextureBrowser) ); + GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string(g_TextureBrowser) ); ++ GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string(g_TextureBrowser) ); + GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string(GlobalTextureBrowser())); + GlobalPreferenceSystem().registerPreference( "ShowShaders", make_property_string( GlobalTextureBrowser().m_showShaders ) ); + GlobalPreferenceSystem().registerPreference( "ShowShaderlistOnly", make_property_string( g_TextureBrowser_shaderlistOnly ) ); + GlobalPreferenceSystem().registerPreference( "FixedSize", make_property_string( g_TextureBrowser_fixedSize ) ); + GlobalPreferenceSystem().registerPreference( "FilterMissing", make_property_string( g_TextureBrowser_filterMissing ) ); + GlobalPreferenceSystem().registerPreference( "EnableAlpha", make_property_string( g_TextureBrowser_enableAlpha ) ); + GlobalPreferenceSystem().registerPreference( "LoadShaders", make_property_string( reinterpret_cast( GlobalTextureBrowser().m_startupShaders ) ) ); + GlobalPreferenceSystem().registerPreference( "WheelMouseInc", make_property_string( GlobalTextureBrowser().m_mouseWheelScrollIncrement ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors0", make_property_string( GlobalTextureBrowser().color_textureback ) ); g_TextureBrowser.shader = texdef_name_default(); diff --cc radiant/xywindow.cpp index baf3f621,b33243f7..e5a4ec8f --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@@ -751,12 -760,12 +765,12 @@@ void xywnd_motion( gdouble x, gdouble y reinterpret_cast( data )->XY_MouseMoved( static_cast( x ), static_cast( y ), buttons_for_state( state ) ); } -gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xywnd ){ +gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){ if ( event->direction == GDK_SCROLL_UP ) { - XYWnd_ZoomIn( xywnd ); + xywnd->ZoomInWithMouse( (int)event->x, (int)event->y ); } else if ( event->direction == GDK_SCROLL_DOWN ) { - XYWnd_ZoomOut( xywnd ); + xywnd->ZoomOut(); } return FALSE; } @@@ -2748,42 -2757,43 +2761,43 @@@ void XYWindow_Construct() GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) ); GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) ); - GlobalCommands_insert( "NextView", FreeCaller(), Accelerator( GDK_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "ZoomIn", FreeCaller(), Accelerator( GDK_Delete ) ); - GlobalCommands_insert( "ZoomOut", FreeCaller(), Accelerator( GDK_Insert ) ); - GlobalCommands_insert( "ViewTop", FreeCaller(), Accelerator( GDK_KP_Home ) ); - GlobalCommands_insert( "ViewSide", FreeCaller(), Accelerator( GDK_KP_Page_Down ) ); - GlobalCommands_insert( "ViewFront", FreeCaller(), Accelerator( GDK_KP_End ) ); - GlobalCommands_insert( "Zoom100", FreeCaller() ); - GlobalCommands_insert( "CenterXYView", FreeCaller(), Accelerator( GDK_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - - 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( "ImprovedWheelZoom", BoolImportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ), BoolExportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ) ); - 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( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) ); - GlobalPreferenceSystem().registerPreference( "NoStipple", BoolImportStringCaller( g_xywindow_globals.m_bNoStipple ), BoolExportStringCaller( g_xywindow_globals.m_bNoStipple ) ); - GlobalPreferenceSystem().registerPreference( "SI_ShowCoords", BoolImportStringCaller( g_xywindow_globals_private.show_coordinates ), BoolExportStringCaller( g_xywindow_globals_private.show_coordinates ) ); - GlobalPreferenceSystem().registerPreference( "SI_ShowOutlines", BoolImportStringCaller( g_xywindow_globals_private.show_outline ), BoolExportStringCaller( g_xywindow_globals_private.show_outline ) ); - GlobalPreferenceSystem().registerPreference( "SI_ShowAxis", BoolImportStringCaller( g_xywindow_globals_private.show_axis ), BoolExportStringCaller( g_xywindow_globals_private.show_axis ) ); - GlobalPreferenceSystem().registerPreference( "CamXYUpdate", BoolImportStringCaller( g_xywindow_globals_private.m_bCamXYUpdate ), BoolExportStringCaller( g_xywindow_globals_private.m_bCamXYUpdate ) ); - GlobalPreferenceSystem().registerPreference( "ShowWorkzone", BoolImportStringCaller( g_xywindow_globals_private.d_show_work ), BoolExportStringCaller( g_xywindow_globals_private.d_show_work ) ); - - GlobalPreferenceSystem().registerPreference( "SI_AxisColors0", Vector3ImportStringCaller( g_xywindow_globals.AxisColorX ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorX ) ); - GlobalPreferenceSystem().registerPreference( "SI_AxisColors1", Vector3ImportStringCaller( g_xywindow_globals.AxisColorY ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorY ) ); - GlobalPreferenceSystem().registerPreference( "SI_AxisColors2", Vector3ImportStringCaller( g_xywindow_globals.AxisColorZ ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorZ ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors1", Vector3ImportStringCaller( g_xywindow_globals.color_gridback ), Vector3ExportStringCaller( g_xywindow_globals.color_gridback ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors2", Vector3ImportStringCaller( g_xywindow_globals.color_gridminor ), Vector3ExportStringCaller( g_xywindow_globals.color_gridminor ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors3", Vector3ImportStringCaller( g_xywindow_globals.color_gridmajor ), Vector3ExportStringCaller( g_xywindow_globals.color_gridmajor ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors6", Vector3ImportStringCaller( g_xywindow_globals.color_gridblock ), Vector3ExportStringCaller( g_xywindow_globals.color_gridblock ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors7", Vector3ImportStringCaller( g_xywindow_globals.color_gridtext ), Vector3ExportStringCaller( g_xywindow_globals.color_gridtext ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors8", Vector3ImportStringCaller( g_xywindow_globals.color_brushes ), Vector3ExportStringCaller( g_xywindow_globals.color_brushes ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors14", Vector3ImportStringCaller( g_xywindow_globals.color_gridmajor_alt ), Vector3ExportStringCaller( g_xywindow_globals.color_gridmajor_alt ) ); - - - GlobalPreferenceSystem().registerPreference( "XZVIS", makeBoolStringImportCallback( ToggleShownImportBoolCaller( g_xz_front_shown ) ), makeBoolStringExportCallback( ToggleShownExportBoolCaller( g_xz_front_shown ) ) ); - GlobalPreferenceSystem().registerPreference( "YZVIS", makeBoolStringImportCallback( ToggleShownImportBoolCaller( g_yz_side_shown ) ), makeBoolStringExportCallback( ToggleShownExportBoolCaller( g_yz_side_shown ) ) ); + GlobalCommands_insert( "NextView", makeCallbackF(XY_Next), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); // fixme: doesn't show its shortcut + GlobalCommands_insert( "ZoomIn", makeCallbackF(XY_ZoomIn), Accelerator( GDK_KEY_Delete ) ); + GlobalCommands_insert( "ZoomOut", makeCallbackF(XY_ZoomOut), Accelerator( GDK_KEY_Insert ) ); + GlobalCommands_insert( "ViewTop", makeCallbackF(XY_Top), Accelerator( GDK_KEY_KP_Home ) ); + GlobalCommands_insert( "ViewSide", makeCallbackF(XY_Side), Accelerator( GDK_KEY_KP_Page_Down ) ); + GlobalCommands_insert( "ViewFront", makeCallbackF(XY_Front), Accelerator( GDK_KEY_KP_End ) ); + GlobalCommands_insert( "Zoom100", makeCallbackF(XY_Zoom100) ); + GlobalCommands_insert( "CenterXYView", makeCallbackF(XY_Focus), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + + GlobalPreferenceSystem().registerPreference( "ClipCaulk", make_property_string( g_clip_useCaulk ) ); + + GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) ); ++ GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", make_property_string( g_xywindow_globals.m_bImprovedWheelZoom ) ); + GlobalPreferenceSystem().registerPreference( "ChaseMouse", make_property_string( g_xywindow_globals_private.m_bChaseMouse ) ); + GlobalPreferenceSystem().registerPreference( "SizePainting", make_property_string( g_xywindow_globals_private.m_bSizePaint ) ); + GlobalPreferenceSystem().registerPreference( "ShowCrosshair", make_property_string( g_xywindow_globals_private.g_bCrossHairs ) ); + GlobalPreferenceSystem().registerPreference( "NoStipple", make_property_string( g_xywindow_globals.m_bNoStipple ) ); + GlobalPreferenceSystem().registerPreference( "SI_ShowCoords", make_property_string( g_xywindow_globals_private.show_coordinates ) ); + GlobalPreferenceSystem().registerPreference( "SI_ShowOutlines", make_property_string( g_xywindow_globals_private.show_outline ) ); + GlobalPreferenceSystem().registerPreference( "SI_ShowAxis", make_property_string( g_xywindow_globals_private.show_axis ) ); + GlobalPreferenceSystem().registerPreference( "CamXYUpdate", make_property_string( g_xywindow_globals_private.m_bCamXYUpdate ) ); + GlobalPreferenceSystem().registerPreference( "ShowWorkzone", make_property_string( g_xywindow_globals_private.d_show_work ) ); + + GlobalPreferenceSystem().registerPreference( "SI_AxisColors0", make_property_string( g_xywindow_globals.AxisColorX ) ); + GlobalPreferenceSystem().registerPreference( "SI_AxisColors1", make_property_string( g_xywindow_globals.AxisColorY ) ); + GlobalPreferenceSystem().registerPreference( "SI_AxisColors2", make_property_string( g_xywindow_globals.AxisColorZ ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors1", make_property_string( g_xywindow_globals.color_gridback ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors2", make_property_string( g_xywindow_globals.color_gridminor ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors3", make_property_string( g_xywindow_globals.color_gridmajor ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors6", make_property_string( g_xywindow_globals.color_gridblock ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors7", make_property_string( g_xywindow_globals.color_gridtext ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors8", make_property_string( g_xywindow_globals.color_brushes ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors14", make_property_string( g_xywindow_globals.color_gridmajor_alt ) ); + + + GlobalPreferenceSystem().registerPreference( "XZVIS", make_property_string( g_xz_front_shown ) ); + GlobalPreferenceSystem().registerPreference( "YZVIS", make_property_string( g_yz_side_shown ) ); Orthographic_registerPreferencesPage(); Clipper_registerPreferencesPage(); diff --cc tools/quake3/q3map2/main.c index 10c1d0a8,9841b4f1..1e2e67d5 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@@ -766,28 -2143,36 +767,36 @@@ skipEXfile if ( !strcmp( token, "}" ) ) { break; } + if ( !strcmp( token, "{" ) ) { + Sys_Printf( "WARNING9: %s : line %d : opening brace inside shader stage\n", temp, scriptline ); + } - if ( !stricmp( token, "mapComp" ) || !stricmp( token, "mapNoComp" ) || !stricmp( token, "animmapcomp" ) || !stricmp( token, "animmapnocomp" ) ){ ++ if ( !Q_stricmp( token, "mapComp" ) || !Q_stricmp( token, "mapNoComp" ) || !Q_stricmp( token, "animmapcomp" ) || !Q_stricmp( token, "animmapnocomp" ) ){ + Sys_Printf( "WARNING7: %s : line %d : unsupported '%s' map directive\n", temp, scriptline, token ); + } /* skip the shader */ if ( !wantShader ) continue; /* digest any images */ - if ( !stricmp( token, "map" ) || - !stricmp( token, "clampMap" ) ) { + if ( !Q_stricmp( token, "map" ) || + !Q_stricmp( token, "clampMap" ) ) { - + hasmap = qtrue; /* get an image */ GetToken( qfalse ); if ( token[ 0 ] != '*' && token[ 0 ] != '$' ) { tex2list( pk3Textures, &pk3TexturesN, ExTextures, &ExTexturesN ); } } - else if ( !stricmp( token, "animMap" ) || - !stricmp( token, "clampAnimMap" ) ) { + else if ( !Q_stricmp( token, "animMap" ) || + !Q_stricmp( token, "clampAnimMap" ) ) { + hasmap = qtrue; GetToken( qfalse );// skip num while ( TokenAvailable() ){ GetToken( qfalse ); tex2list( pk3Textures, &pk3TexturesN, ExTextures, &ExTexturesN ); } } - else if ( !stricmp( token, "videoMap" ) ){ + else if ( !Q_stricmp( token, "videoMap" ) ){ + hasmap = qtrue; GetToken( qfalse ); FixDOSName( token ); if ( strchr( token, '/' ) == NULL && strchr( token, '\\' ) == NULL ){ @@@ -812,6 -2197,9 +821,9 @@@ } } } - else if ( !strnicmp( token, "implicit", 8 ) ){ ++ else if ( !Q_strncasecmp( token, "implicit", 8 ) ){ + Sys_Printf( "WARNING5: %s : line %d : unsupported %s shader\n", temp, scriptline, token ); + } /* skip the shader */ else if ( !wantShader ) continue; @@@ -829,7 -2217,8 +841,8 @@@ } /* skyparms */ - else if ( !stricmp( token, "skyParms" ) ) { + else if ( !Q_stricmp( token, "skyParms" ) ) { + hasmap = qtrue; /* get image base */ GetToken( qfalse ); @@@ -853,6 -2242,9 +866,9 @@@ GetToken( qfalse ); GetToken( qfalse ); } - else if ( !stricmp( token, "fogparms" ) ){ ++ else if ( !Q_stricmp( token, "fogparms" ) ){ + hasmap = qtrue; + } } //exclude shader @@@ -1872,14 -3271,9 +1895,9 @@@ skipEXrefile } //exclude shader - if ( wantShader && !hasmap ){ - Sys_Printf( "WARNING8: %s : shader has no known maps\n", pk3Shaders + shader*65 ); - wantShader = qfalse; - *( pk3Shaders + shader*65 ) = '\0'; - } if ( wantShader ){ for ( j = 0; j < ExShadersN; j++ ){ - if ( !stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){ + if ( !Q_stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){ wantShader = qfalse; *( pk3Shaders + shader*65 ) = '\0'; break;