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 );
}
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" );
}
}
-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(){
}
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;
}
GlobalEntityAttributes_clear();
}
-GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
- GtkWidget* vbox = gtk_vbox_new( FALSE, 2 );
- gtk_widget_show( vbox );
+ 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;
+ }
+
+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( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
+ g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_destroyWindowKB ), 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;
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 );
}
{
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 );
}
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 );
GlobalCommands_insert( "ChooseOrthoViewNameColor", makeCallback( g_ColoursMenu.m_viewname ) );
- GlobalCommands_insert( "CSGSubtract", FreeCaller<CSG_Subtract>(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "CSGMerge", FreeCaller<CSG_Merge>(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "CSGHollow", FreeCaller<CSG_MakeHollow>() );
- GlobalCommands_insert( "CSGroom", FreeCaller<CSG_MakeRoom>() );
+ 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();
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<float>( gtk_spin_button_get_value( rotateDialog->x ) );
eulerXYZ[1] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->y ) );
eulerXYZ[2] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->z ) );
return TRUE;
}
-static gboolean rotatedlg_ok( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_ok( ui::Widget widget, RotateDialog* rotateDialog ){
rotatedlg_apply( widget, rotateDialog );
- gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
+ // rotatedlg_cancel( widget, rotateDialog );
+ rotateDialog->window.hide();
return TRUE;
}
return TRUE;
}
-static gboolean scaledlg_ok( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_ok( ui::Widget widget, ScaleDialog* scaleDialog ){
scaledlg_apply( widget, scaleDialog );
- gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
+ //scaledlg_cancel( widget, scaleDialog );
+ scaleDialog->window.hide();
return TRUE;
}
void TextureGroups_addDirectory( TextureGroups& groups, const char* directory ){
groups.insert( directory );
}
-typedef ReferenceCaller1<TextureGroups, const char*, TextureGroups_addDirectory> TextureGroupsAddDirectoryCaller;
+
-namespace
-{
-bool g_TextureBrowser_shaderlistOnly = false;
-bool g_TextureBrowser_fixedSize = true;
-bool g_TextureBrowser_filterNotex = false;
-}
+typedef ReferenceCaller<TextureGroups, void(const char*), TextureGroups_addDirectory> TextureGroupsAddDirectoryCaller;
class DeferredAdjustment
{
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() :
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 );
importer( buffer.c_str() );
}
+struct TextureScale {
+ static void Export(const TextureBrowser &self, const Callback<void(int)> &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<TextureBrowser, int, TextureScaleImport> 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<void(int)> &returnz) {
+ returnz(g_TextureBrowser.m_uniformTextureSize);
}
-}
-typedef ReferenceCaller1<TextureBrowser, const IntImportCallback&, TextureScaleExport> TextureScaleExportCaller;
-void UniformTextureSizeImport( TextureBrowser& textureBrowser, int value ){
- if ( value >= 16 )
- TextureBrowser_setUniformSize( textureBrowser, value );
-}
-typedef ReferenceCaller1<TextureBrowser, int, UniformTextureSizeImport> 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<TextureBrowser, int, UniformTextureMinSizeImport> UniformTextureMinSizeImportCaller;
++struct UniformTextureMinSize {
++ static void Export(const TextureBrowser &self, const Callback<void(int)> &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",
page.appendCombo(
"Texture Thumbnail Scale",
STRING_ARRAY_RANGE( texture_scale ),
- IntImportCallback( TextureScaleImportCaller( GlobalTextureBrowser() ) ),
- IntExportCallback( TextureScaleExportCaller( GlobalTextureBrowser() ) )
+ make_property<TextureScale>(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<int&>( 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 );
void TextureClipboard_textureSelected( const char* shader );
void TextureBrowser_Construct(){
- GlobalCommands_insert( "ShaderInfo", FreeCaller<TextureBrowser_shaderInfo>() );
- GlobalCommands_insert( "ShowUntagged", FreeCaller<TextureBrowser_showUntagged>() );
- GlobalCommands_insert( "AddTag", FreeCaller<TextureBrowser_addTag>() );
- GlobalCommands_insert( "RenameTag", FreeCaller<TextureBrowser_renameTag>() );
- GlobalCommands_insert( "DeleteTag", FreeCaller<TextureBrowser_deleteTag>() );
- GlobalCommands_insert( "CopyTag", FreeCaller<TextureBrowser_copyTag>() );
- GlobalCommands_insert( "PasteTag", FreeCaller<TextureBrowser_pasteTag>() );
- GlobalCommands_insert( "RefreshShaders", FreeCaller<RefreshShaders>() );
- GlobalToggles_insert( "ShowInUse", FreeCaller<TextureBrowser_ToggleHideUnused>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) );
- GlobalCommands_insert( "ShowAllTextures", FreeCaller<TextureBrowser_showAll>(), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ToggleTextures", FreeCaller<TextureBrowser_toggleShow>(), Accelerator( 'T' ) );
- GlobalToggles_insert( "ToggleShowShaders", FreeCaller<TextureBrowser_ToggleShowShaders>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) );
- GlobalToggles_insert( "ToggleShowShaderlistOnly", FreeCaller<TextureBrowser_ToggleShowShaderListOnly>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
- GlobalToggles_insert( "FixedSize", FreeCaller<TextureBrowser_FixedSize>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) );
- GlobalToggles_insert( "FilterNotex", FreeCaller<TextureBrowser_FilterNotex>(), 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<int&>( GlobalTextureBrowser().m_startupShaders ) ), IntExportStringCaller( reinterpret_cast<int&>( 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<TextureScale>(g_TextureBrowser) );
+ GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string<UniformTextureSize>(g_TextureBrowser) );
++ GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string<UniformTextureMinSize>(g_TextureBrowser) );
+ GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string<TextureBrowser_ShowScrollbar>(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<int&>( 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();
reinterpret_cast<XYWnd*>( data )->XY_MouseMoved( static_cast<int>( x ), static_cast<int>( 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;
}
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<XY_Next>(), Accelerator( GDK_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_Delete ) );
- GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_Insert ) );
- GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KP_Home ) );
- GlobalCommands_insert( "ViewSide", FreeCaller<XY_Side>(), Accelerator( GDK_KP_Page_Down ) );
- GlobalCommands_insert( "ViewFront", FreeCaller<XY_Front>(), Accelerator( GDK_KP_End ) );
- GlobalCommands_insert( "Zoom100", FreeCaller<XY_Zoom100>() );
- GlobalCommands_insert( "CenterXYView", FreeCaller<XY_Focus>(), 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<ToggleShown_Bool>( g_xz_front_shown ) );
+ GlobalPreferenceSystem().registerPreference( "YZVIS", make_property_string<ToggleShown_Bool>( g_yz_side_shown ) );
Orthographic_registerPreferencesPage();
Clipper_registerPreferencesPage();
if ( !strcmp( token, "}" ) ) {
break;
}
- if ( !stricmp( token, "mapComp" ) || !stricmp( token, "mapNoComp" ) || !stricmp( token, "animmapcomp" ) || !stricmp( token, "animmapnocomp" ) ){
+ if ( !strcmp( token, "{" ) ) {
+ Sys_Printf( "WARNING9: %s : line %d : opening brace inside shader stage\n", temp, scriptline );
+ }
++ 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 ){
}
}
}
- 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;
}
/* skyparms <outer image> <cloud height> <inner image> */
- else if ( !stricmp( token, "skyParms" ) ) {
+ else if ( !Q_stricmp( token, "skyParms" ) ) {
+ hasmap = qtrue;
/* get image base */
GetToken( qfalse );
GetToken( qfalse );
GetToken( qfalse );
}
- else if ( !stricmp( token, "fogparms" ) ){
++ else if ( !Q_stricmp( token, "fogparms" ) ){
+ hasmap = qtrue;
+ }
}
//exclude shader
}
//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;