| 543 | | |
|---|
| 544 | | #else // GTK_PLUGIN |
|---|
| 545 | | |
|---|
| 546 | | CConfigDialog::CConfigDialog(CWnd* pParent /*=NULL*/) |
|---|
| 547 | | : CDialog(CConfigDialog::IDD, pParent) |
|---|
| 548 | | { |
|---|
| 549 | | //{{AFX_DATA_INIT(CConfigDialog) |
|---|
| 550 | | //}}AFX_DATA_INIT |
|---|
| 551 | | } |
|---|
| 552 | | |
|---|
| 553 | | |
|---|
| 554 | | void CConfigDialog::DoDataExchange(CDataExchange* pDX) |
|---|
| 555 | | { |
|---|
| 556 | | CDialog::DoDataExchange(pDX); |
|---|
| 557 | | //{{AFX_DATA_MAP(CConfigDialog) |
|---|
| 558 | | DDX_Control(pDX, IDC_CLIP, m_clip_ctrl); |
|---|
| 559 | | DDX_Control(pDX, IDC_CUBIC, m_cubic_ctrl); |
|---|
| 560 | | DDX_Control(pDX, IDC_SCROLL_CUBIC, m_scroll_cubic_ctrl); |
|---|
| 561 | | DDX_Control(pDX, IDC_LINES, m_line_ctrl); |
|---|
| 562 | | DDX_Control(pDX, IDC_SCROLL_3D_TRANS, m_scroll_3d_trans_ctrl); |
|---|
| 563 | | DDX_Control(pDX, IDC_3D_TRANS, m_3d_trans_ctrl); |
|---|
| 564 | | DDX_Control(pDX, IDC_POLY, m_poly_ctrl); |
|---|
| 565 | | DDX_Control(pDX, IDC_FOG, m_fog_ctrl); |
|---|
| 566 | | DDX_Control(pDX, IDC_ZBUFFER, m_z_ctrl); |
|---|
| 567 | | DDX_Control(pDX, IDC_SCROLL_3D_WIDTH, m_scroll_3d_width_ctrl); |
|---|
| 568 | | DDX_Control(pDX, IDC_ANTI_ALIAS_3D, m_aa_3d_ctrl); |
|---|
| 569 | | DDX_Control(pDX, IDC_3D_WIDTH, m_3d_width_ctrl); |
|---|
| 570 | | DDX_Control(pDX, IDC_ANTI_ALIAS_2D, m_aa_2d_ctrl); |
|---|
| 571 | | DDX_Control(pDX, IDC_SCROLL_2D_WIDTH, m_scroll_2d_width_ctrl); |
|---|
| 572 | | DDX_Control(pDX, IDC_2D_WIDTH, m_2d_width_ctrl); |
|---|
| 573 | | DDX_Control(pDX, IDC_CONFIG_3D, m_3d_ctrl); |
|---|
| 574 | | DDX_Control(pDX, IDC_CONFIG_2D, m_2d_ctrl); |
|---|
| 575 | | //}}AFX_DATA_MAP |
|---|
| 576 | | } |
|---|
| 577 | | |
|---|
| 578 | | |
|---|
| 579 | | BEGIN_MESSAGE_MAP(CConfigDialog, CDialog) |
|---|
| 580 | | //{{AFX_MSG_MAP(CConfigDialog) |
|---|
| 581 | | ON_WM_HSCROLL() |
|---|
| 582 | | ON_BN_CLICKED(IDC_ANTI_ALIAS_2D, OnAntiAlias2d) |
|---|
| 583 | | ON_BN_CLICKED(IDC_CONFIG_2D, OnConfig2d) |
|---|
| 584 | | ON_BN_CLICKED(IDC_CONFIG_3D, OnConfig3d) |
|---|
| 585 | | ON_BN_CLICKED(IDC_COLOR_2D, OnColor2d) |
|---|
| 586 | | ON_BN_CLICKED(IDC_ANTI_ALIAS_3D, OnAntiAlias3d) |
|---|
| 587 | | ON_BN_CLICKED(IDC_COLOR_3D, OnColor3d) |
|---|
| 588 | | ON_BN_CLICKED(IDC_COLOR_FOG, OnColorFog) |
|---|
| 589 | | ON_BN_CLICKED(IDC_FOG, OnFog) |
|---|
| 590 | | ON_CBN_SELCHANGE(IDC_ZBUFFER, OnSelchangeZbuffer) |
|---|
| 591 | | ON_BN_CLICKED(IDC_POLY, OnPoly) |
|---|
| 592 | | ON_BN_CLICKED(IDC_LINES, OnLines) |
|---|
| 593 | | ON_BN_CLICKED(IDC_CLIP, OnClip) |
|---|
| 594 | | //}}AFX_MSG_MAP |
|---|
| 595 | | END_MESSAGE_MAP() |
|---|
| 596 | | |
|---|
| 597 | | ///////////////////////////////////////////////////////////////////////////// |
|---|
| 598 | | // CConfigDialog message handlers |
|---|
| 599 | | |
|---|
| 600 | | void CConfigDialog::Set2DText() |
|---|
| 601 | | { |
|---|
| 602 | | char s[40]; |
|---|
| 603 | | |
|---|
| 604 | | sprintf(s, "Line Width = %6.3f", portals.width_2d * 0.5f); |
|---|
| 605 | | |
|---|
| 606 | | m_2d_width_ctrl.SetWindowText(s); |
|---|
| 607 | | } |
|---|
| 608 | | |
|---|
| 609 | | void CConfigDialog::Set3DText() |
|---|
| 610 | | { |
|---|
| 611 | | char s[40]; |
|---|
| 612 | | |
|---|
| 613 | | sprintf(s, "Line Width = %6.3f", portals.width_3d * 0.5f); |
|---|
| 614 | | |
|---|
| 615 | | m_3d_width_ctrl.SetWindowText(s); |
|---|
| 616 | | } |
|---|
| 617 | | |
|---|
| 618 | | void CConfigDialog::Set3DTransText() |
|---|
| 619 | | { |
|---|
| 620 | | char s[40]; |
|---|
| 621 | | |
|---|
| 622 | | sprintf(s, "Polygon transparency = %d%%", (int)portals.trans_3d); |
|---|
| 623 | | |
|---|
| 624 | | m_3d_trans_ctrl.SetWindowText(s); |
|---|
| 625 | | } |
|---|
| 626 | | |
|---|
| 627 | | void CConfigDialog::SetClipText() |
|---|
| 628 | | { |
|---|
| 629 | | char s[40]; |
|---|
| 630 | | |
|---|
| 631 | | sprintf(s, "Cubic clip range = %d", (int)portals.clip_range * 64); |
|---|
| 632 | | |
|---|
| 633 | | m_cubic_ctrl.SetWindowText(s); |
|---|
| 634 | | } |
|---|
| 635 | | |
|---|
| 636 | | qboolean CConfigDialog::OnInitDialog() |
|---|
| 637 | | { |
|---|
| 638 | | CDialog::OnInitDialog(); |
|---|
| 639 | | |
|---|
| 640 | | m_2d_ctrl.SetCheck(portals.show_2d); |
|---|
| 641 | | m_aa_2d_ctrl.SetCheck(portals.aa_2d); |
|---|
| 642 | | Set2DText(); |
|---|
| 643 | | |
|---|
| 644 | | m_scroll_2d_width_ctrl.SetScrollRange(2, 40, FALSE); |
|---|
| 645 | | m_scroll_2d_width_ctrl.SetScrollPos((int)portals.width_2d, TRUE); |
|---|
| 646 | | |
|---|
| 647 | | m_3d_ctrl.SetCheck(portals.show_3d); |
|---|
| 648 | | m_fog_ctrl.SetCheck(portals.fog); |
|---|
| 649 | | m_poly_ctrl.SetCheck(portals.polygons); |
|---|
| 650 | | m_line_ctrl.SetCheck(portals.lines); |
|---|
| 651 | | m_aa_3d_ctrl.SetCheck(portals.aa_3d); |
|---|
| 652 | | m_z_ctrl.SetCurSel(portals.zbuffer); |
|---|
| 653 | | m_clip_ctrl.SetCheck(portals.clip); |
|---|
| 654 | | |
|---|
| 655 | | Set3DText(); |
|---|
| 656 | | Set3DTransText(); |
|---|
| 657 | | SetClipText(); |
|---|
| 658 | | |
|---|
| 659 | | m_scroll_3d_width_ctrl.SetScrollRange(2, 40, FALSE); |
|---|
| 660 | | m_scroll_3d_width_ctrl.SetScrollPos((int)portals.width_3d, TRUE); |
|---|
| 661 | | m_scroll_3d_trans_ctrl.SetScrollRange(0, 100, FALSE); |
|---|
| 662 | | m_scroll_3d_trans_ctrl.SetScrollPos((int)portals.trans_3d, TRUE); |
|---|
| 663 | | m_scroll_cubic_ctrl.SetScrollRange(1, 128, FALSE); |
|---|
| 664 | | m_scroll_cubic_ctrl.SetScrollPos((int)portals.clip_range, TRUE); |
|---|
| 665 | | |
|---|
| 666 | | return TRUE; // return TRUE unless you set the focus to a control |
|---|
| 667 | | // EXCEPTION: OCX Property Pages should return FALSE |
|---|
| 668 | | } |
|---|
| 669 | | |
|---|
| 670 | | void CConfigDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) |
|---|
| 671 | | { |
|---|
| 672 | | float *adj; |
|---|
| 673 | | float scr_min, scr_max, scr_big; |
|---|
| 674 | | |
|---|
| 675 | | if(nSBCode == SB_THUMBPOSITION) |
|---|
| 676 | | { |
|---|
| 677 | | CDialog::OnHScroll(nSBCode, nPos, pScrollBar); |
|---|
| 678 | | return; |
|---|
| 679 | | } |
|---|
| 680 | | |
|---|
| 681 | | if(pScrollBar == &m_scroll_2d_width_ctrl) |
|---|
| 682 | | { |
|---|
| 683 | | scr_min = 2.0f; |
|---|
| 684 | | scr_max = 40.0f; |
|---|
| 685 | | scr_big = 4.0f; |
|---|
| 686 | | |
|---|
| 687 | | adj = &portals.width_2d; |
|---|
| 688 | | } |
|---|
| 689 | | else if(pScrollBar == &m_scroll_3d_width_ctrl) |
|---|
| 690 | | { |
|---|
| 691 | | scr_min = 2.0f; |
|---|
| 692 | | scr_max = 40.0f; |
|---|
| 693 | | scr_big = 4.0f; |
|---|
| 694 | | |
|---|
| 695 | | adj = &portals.width_3d; |
|---|
| 696 | | } |
|---|
| 697 | | else if(pScrollBar == &m_scroll_3d_trans_ctrl) |
|---|
| 698 | | { |
|---|
| 699 | | scr_min = 0.0f; |
|---|
| 700 | | scr_max = 100.0f; |
|---|
| 701 | | scr_big = 10.0f; |
|---|
| 702 | | |
|---|
| 703 | | adj = &portals.trans_3d; |
|---|
| 704 | | } |
|---|
| 705 | | else if(pScrollBar == &m_scroll_cubic_ctrl) |
|---|
| 706 | | { |
|---|
| 707 | | scr_min = 1.0f; |
|---|
| 708 | | scr_max = 128.0f; |
|---|
| 709 | | scr_big = 8.0f; |
|---|
| 710 | | |
|---|
| 711 | | adj = &portals.clip_range; |
|---|
| 712 | | } |
|---|
| 713 | | else |
|---|
| 714 | | { |
|---|
| 715 | | CDialog::OnHScroll(nSBCode, nPos, pScrollBar); |
|---|
| 716 | | return; |
|---|
| 717 | | } |
|---|
| 718 | | |
|---|
| 719 | | switch(nSBCode) |
|---|
| 720 | | { |
|---|
| 721 | | case SB_LEFT: |
|---|
| 722 | | *adj = scr_min; |
|---|
| 723 | | pScrollBar->SetScrollPos((int)scr_min, TRUE); |
|---|
| 724 | | break; |
|---|
| 725 | | case SB_RIGHT: |
|---|
| 726 | | *adj = scr_max; |
|---|
| 727 | | pScrollBar->SetScrollPos((int)scr_max, TRUE); |
|---|
| 728 | | break; |
|---|
| 729 | | case SB_LINELEFT: |
|---|
| 730 | | *adj -= 1.0f; |
|---|
| 731 | | |
|---|
| 732 | | if(*adj < scr_min) |
|---|
| 733 | | *adj = scr_min; |
|---|
| 734 | | |
|---|
| 735 | | pScrollBar->SetScrollPos((int)(*adj), TRUE); |
|---|
| 736 | | |
|---|
| 737 | | break; |
|---|
| 738 | | case SB_LINERIGHT: |
|---|
| 739 | | *adj += 1.0f; |
|---|
| 740 | | |
|---|
| 741 | | if(*adj > scr_max) |
|---|
| 742 | | *adj = scr_max; |
|---|
| 743 | | |
|---|
| 744 | | pScrollBar->SetScrollPos((int)(*adj), TRUE); |
|---|
| 745 | | |
|---|
| 746 | | break; |
|---|
| 747 | | case SB_PAGELEFT: |
|---|
| 748 | | *adj -= scr_big; |
|---|
| 749 | | |
|---|
| 750 | | if(*adj < scr_min) |
|---|
| 751 | | *adj = scr_min; |
|---|
| 752 | | |
|---|
| 753 | | pScrollBar->SetScrollPos((int)(*adj), TRUE); |
|---|
| 754 | | |
|---|
| 755 | | break; |
|---|
| 756 | | case SB_PAGERIGHT: |
|---|
| 757 | | *adj += scr_big; |
|---|
| 758 | | |
|---|
| 759 | | if(*adj > scr_max) |
|---|
| 760 | | *adj = scr_max; |
|---|
| 761 | | |
|---|
| 762 | | pScrollBar->SetScrollPos((int)(*adj), TRUE); |
|---|
| 763 | | |
|---|
| 764 | | break; |
|---|
| 765 | | case SB_THUMBTRACK: |
|---|
| 766 | | *adj = (float)nPos; |
|---|
| 767 | | |
|---|
| 768 | | break; |
|---|
| 769 | | case SB_ENDSCROLL: |
|---|
| 770 | | pScrollBar->SetScrollPos((int)(*adj), TRUE); |
|---|
| 771 | | |
|---|
| 772 | | break; |
|---|
| 773 | | default: |
|---|
| 774 | | CDialog::OnHScroll(nSBCode, nPos, pScrollBar); |
|---|
| 775 | | } |
|---|
| 776 | | |
|---|
| 777 | | if(pScrollBar == &m_scroll_2d_width_ctrl) |
|---|
| 778 | | { |
|---|
| 779 | | Set2DText(); |
|---|
| 780 | | |
|---|
| 781 | | if(interfaces_started) |
|---|
| 782 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_2D); |
|---|
| 783 | | } |
|---|
| 784 | | else if(pScrollBar == &m_scroll_3d_width_ctrl) |
|---|
| 785 | | { |
|---|
| 786 | | Set3DText(); |
|---|
| 787 | | |
|---|
| 788 | | if(interfaces_started) |
|---|
| 789 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 790 | | } |
|---|
| 791 | | else if(pScrollBar == &m_scroll_3d_trans_ctrl) |
|---|
| 792 | | { |
|---|
| 793 | | Set3DTransText(); |
|---|
| 794 | | |
|---|
| 795 | | if(interfaces_started) |
|---|
| 796 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 797 | | } |
|---|
| 798 | | else if(pScrollBar == &m_scroll_cubic_ctrl) |
|---|
| 799 | | { |
|---|
| 800 | | SetClipText(); |
|---|
| 801 | | |
|---|
| 802 | | if(interfaces_started) |
|---|
| 803 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 804 | | } |
|---|
| 805 | | } |
|---|
| 806 | | |
|---|
| 807 | | void CConfigDialog::OnAntiAlias2d() |
|---|
| 808 | | { |
|---|
| 809 | | portals.aa_2d = m_aa_2d_ctrl.GetCheck(); |
|---|
| 810 | | |
|---|
| 811 | | if(interfaces_started) |
|---|
| 812 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_2D); |
|---|
| 813 | | } |
|---|
| 814 | | |
|---|
| 815 | | void CConfigDialog::OnConfig2d() |
|---|
| 816 | | { |
|---|
| 817 | | portals.show_2d = m_2d_ctrl.GetCheck(); |
|---|
| 818 | | |
|---|
| 819 | | if(interfaces_started) |
|---|
| 820 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_2D); |
|---|
| 821 | | } |
|---|
| 822 | | |
|---|
| 823 | | void CConfigDialog::OnColor2d() |
|---|
| 824 | | { |
|---|
| 825 | | CColorDialog dlg(portals.color_2d, CC_ANYCOLOR, this); |
|---|
| 826 | | |
|---|
| 827 | | if(dlg.DoModal() == IDOK) |
|---|
| 828 | | { |
|---|
| 829 | | portals.color_2d = dlg.GetColor(); |
|---|
| 830 | | |
|---|
| 831 | | portals.FixColors(); |
|---|
| 832 | | |
|---|
| 833 | | if(interfaces_started) |
|---|
| 834 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_2D); |
|---|
| 835 | | } |
|---|
| 836 | | } |
|---|
| 837 | | |
|---|
| 838 | | void CConfigDialog::OnConfig3d() |
|---|
| 839 | | { |
|---|
| 840 | | portals.show_3d = m_3d_ctrl.GetCheck(); |
|---|
| 841 | | |
|---|
| 842 | | if(interfaces_started) |
|---|
| 843 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 844 | | } |
|---|
| 845 | | |
|---|
| 846 | | |
|---|
| 847 | | void CConfigDialog::OnAntiAlias3d() |
|---|
| 848 | | { |
|---|
| 849 | | portals.aa_3d = m_aa_3d_ctrl.GetCheck(); |
|---|
| 850 | | |
|---|
| 851 | | if(interfaces_started) |
|---|
| 852 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 853 | | } |
|---|
| 854 | | |
|---|
| 855 | | void CConfigDialog::OnColor3d() |
|---|
| 856 | | { |
|---|
| 857 | | CColorDialog dlg(portals.color_3d, CC_ANYCOLOR, this); |
|---|
| 858 | | |
|---|
| 859 | | if(dlg.DoModal() == IDOK) |
|---|
| 860 | | { |
|---|
| 861 | | portals.color_3d = dlg.GetColor(); |
|---|
| 862 | | |
|---|
| 863 | | portals.FixColors(); |
|---|
| 864 | | |
|---|
| 865 | | if(interfaces_started) |
|---|
| 866 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 867 | | } |
|---|
| 868 | | } |
|---|
| 869 | | |
|---|
| 870 | | void CConfigDialog::OnColorFog() |
|---|
| 871 | | { |
|---|
| 872 | | CColorDialog dlg(portals.color_fog, CC_ANYCOLOR, this); |
|---|
| 873 | | |
|---|
| 874 | | if(dlg.DoModal() == IDOK) |
|---|
| 875 | | { |
|---|
| 876 | | portals.color_fog = dlg.GetColor(); |
|---|
| 877 | | |
|---|
| 878 | | portals.FixColors(); |
|---|
| 879 | | |
|---|
| 880 | | if(interfaces_started) |
|---|
| 881 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 882 | | } |
|---|
| 883 | | } |
|---|
| 884 | | |
|---|
| 885 | | void CConfigDialog::OnFog() |
|---|
| 886 | | { |
|---|
| 887 | | portals.fog = m_fog_ctrl.GetCheck(); |
|---|
| 888 | | |
|---|
| 889 | | if(interfaces_started) |
|---|
| 890 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 891 | | } |
|---|
| 892 | | |
|---|
| 893 | | void CConfigDialog::OnSelchangeZbuffer() |
|---|
| 894 | | { |
|---|
| 895 | | portals.zbuffer = m_z_ctrl.GetCurSel(); |
|---|
| 896 | | |
|---|
| 897 | | if(interfaces_started) |
|---|
| 898 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 899 | | } |
|---|
| 900 | | |
|---|
| 901 | | void CConfigDialog::OnPoly() |
|---|
| 902 | | { |
|---|
| 903 | | portals.polygons = m_poly_ctrl.GetCheck(); |
|---|
| 904 | | |
|---|
| 905 | | if(interfaces_started) |
|---|
| 906 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 907 | | } |
|---|
| 908 | | |
|---|
| 909 | | void CConfigDialog::OnLines() |
|---|
| 910 | | { |
|---|
| 911 | | portals.lines = m_line_ctrl.GetCheck(); |
|---|
| 912 | | |
|---|
| 913 | | if(interfaces_started) |
|---|
| 914 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 915 | | } |
|---|
| 916 | | |
|---|
| 917 | | void CConfigDialog::OnClip() |
|---|
| 918 | | { |
|---|
| 919 | | portals.clip = m_clip_ctrl.GetCheck(); |
|---|
| 920 | | |
|---|
| 921 | | if(interfaces_started) |
|---|
| 922 | | g_FuncTable.m_pfnSysUpdateWindows(UPDATE_3D); |
|---|
| 923 | | } |
|---|
| 924 | | |
|---|
| 925 | | #endif // GTK_PLUGIN |
|---|