public void LoadPreferences()
        {
            Directory.SetCurrentDirectory(m_filepath_root);

            //m_filepath_root = UserPrefs.GetString("filepath_root", m_filepath_root);
            m_filepath_decal_textures = UserPrefs.GetString("filepath_decal_textures", m_filepath_decal_textures);
            m_filepath_level_textures = UserPrefs.GetString("filepath_level_textures", m_filepath_level_textures);
            m_filepath_decals         = UserPrefs.GetString("filepath_decals", m_filepath_decals);

            m_grid_display = (GridDisplay)UserPrefs.GetInt("grid_display", (int)m_grid_display);
            m_grid_spacing = UserPrefs.GetFloat("grid_spacing", m_grid_spacing);
            SetGridLines();
            m_grid_snap = UserPrefs.GetFloat("grid_snap", m_grid_snap);

            m_extrude_length = UserPrefs.GetFloat("extrude_length", m_extrude_length);
            m_inset_pct      = UserPrefs.GetInt("inset_pct", m_inset_pct);
            m_inset_length   = UserPrefs.GetFloat("inset_length", m_inset_length);
            m_bevel_width    = UserPrefs.GetFloat("bevel_width", m_bevel_width);

            m_coplanar_tol = UserPrefs.GetInt("coplanar_tol", m_coplanar_tol);
            m_side_select  = (SideSelect)UserPrefs.GetInt("side_select", (int)m_side_select);
            m_drag_mode    = (DragMode)UserPrefs.GetInt("drag_mode", (int)m_drag_mode);

            m_view_mode_ortho = (ViewMode)UserPrefs.GetInt("view_mode_ortho", (int)m_view_mode_ortho);
            m_view_mode_persp = (ViewMode)UserPrefs.GetInt("view_mode_persp", (int)m_view_mode_persp);
            m_view_persp_fov  = UserPrefs.GetInt("view_persp_fov", m_view_persp_fov);
            m_view_layout     = (ViewLayout)UserPrefs.GetInt("view_layout", (int)m_view_layout);
            m_bg_color        = (BGColor)UserPrefs.GetInt("bg_color", (int)m_bg_color);
            m_gimbal_display  = (GimbalDisplay)UserPrefs.GetInt("gimbal_display", (int)m_gimbal_display);
            m_lighting_type   = (LightingType)UserPrefs.GetInt("lighting_type", (int)m_lighting_type);
            m_pivot_mode      = (PivotMode)UserPrefs.GetInt("pivot_mode", (int)m_pivot_mode);

            m_low_res_force = UserPrefs.GetBool("low_res_force", m_low_res_force);
            forceLowResTexturesToolStripMenuItem.Checked = m_low_res_force;

            m_tex_list_loc       = UserPrefs.GetPoint("tex_list_loc", texture_list.Location);
            m_tex_list_sz        = UserPrefs.GetPoint("tex_list_sz", (Point)texture_list.Size);
            m_tunnel_builder_loc = UserPrefs.GetPoint("tunnel_builder_loc", tunnel_builder.Location);
            texture_list.Size    = (Size)m_tex_list_sz;

            for (int i = 0; i < RECENT_NUM; i++)
            {
                m_recent_files[i] = UserPrefs.GetString("recent" + i.ToString(), m_recent_files[i]);
            }
            UpdateRecentFileMenu();
        }
        public void LoadPreferences()
        {
            Directory.SetCurrentDirectory(m_filepath_root);

            m_grid_display = (GridDisplay)UserPrefs.GetInt("grid_display", (int)m_grid_display);
            m_grid_spacing = UserPrefs.GetInt("grid_spacing", m_grid_spacing);
            m_grid_snap    = UserPrefs.GetFloat("grid_snap", m_grid_snap);

            m_coplanar_tol   = UserPrefs.GetInt("coplanar_tol", m_coplanar_tol);
            m_rotate_angle   = UserPrefs.GetInt("rotate_angle", m_rotate_angle);
            m_side_select    = (SideSelect)UserPrefs.GetInt("side_select", (int)m_side_select);
            m_insert_advance = UserPrefs.GetBool("insert_advance", m_insert_advance);
            m_drag_mode      = (DragMode)UserPrefs.GetInt("drag_mode", (int)m_drag_mode);

            m_view_mode_ortho   = (ViewMode)UserPrefs.GetInt("view_mode_ortho", (int)m_view_mode_ortho);
            m_view_mode_persp   = (ViewMode)UserPrefs.GetInt("view_mode_persp", (int)m_view_mode_persp);
            m_view_persp_fov    = UserPrefs.GetInt("view_persp_fov", m_view_persp_fov);
            m_view_layout       = (ViewLayout)UserPrefs.GetInt("view_layout", (int)m_view_layout);
            m_bg_color          = (BGColor)UserPrefs.GetInt("bg_color", (int)m_bg_color);
            m_gimbal_display    = (GimbalDisplay)UserPrefs.GetInt("gimbal_display", (int)m_gimbal_display);
            m_lighting_type     = (LightingType)UserPrefs.GetInt("lighting_type", (int)m_lighting_type);
            m_cp_display        = (ClipPlaneDisplay)UserPrefs.GetInt("clip_decal", (int)m_cp_display);
            m_insert_decal      = (InsertDecal)UserPrefs.GetInt("insert_decal", (int)m_insert_decal);
            m_show_3d_text_type = (ShowTextType)UserPrefs.GetInt("show_segment_numbers", (int)m_show_3d_text_type);
            m_auto_center       = UserPrefs.GetBool("auto_center", m_auto_center);

            m_decal_list_loc       = UserPrefs.GetPoint("decal_list_loc", decal_list.Location);
            m_decal_list_sz        = UserPrefs.GetPoint("decal_list_sz", (Point)decal_list.Size);
            m_tex_list_loc         = UserPrefs.GetPoint("tex_list_loc", texture_list.Location);
            m_tex_list_sz          = UserPrefs.GetPoint("tex_list_sz", (Point)texture_list.Size);
            m_texture_set_list_loc = UserPrefs.GetPoint("texture_set_list_loc", texture_list.Location);
            m_texture_set_list_sz  = UserPrefs.GetPoint("texture_set_list_sz", (Point)texture_list.Size);
            m_uv_editor_loc        = UserPrefs.GetPoint("uv_editor_loc", uv_editor.Location);
            m_uv_editor_sz         = UserPrefs.GetPoint("uv_editor_sz", (Point)uv_editor.Size);

            decal_list.Size   = (Size)m_decal_list_sz;
            texture_list.Size = (Size)m_tex_list_sz;
            uv_editor.Size    = (Size)m_uv_editor_sz;

            for (int i = 0; i < NumRecentFiles; i++)
            {
                string recent_file = GetRecentFile(i);
                SetRecentFile(i, UserPrefs.GetString("recent" + i.ToString(), recent_file));
            }
            Shell.UpdateRecentFileMenu();

            m_pivot_mode = (PivotMode)UserPrefs.GetInt("entity_pivot", (int)m_pivot_mode);

            m_editor_layout = UserPrefs.GetString("layout", string.Empty);

            //Save whether pop-up windows are open at startup
            m_decal_list_visible       = UserPrefs.GetBool("decal_list_vis", false);
            m_texture_list_visible     = UserPrefs.GetBool("tex_list_vis", false);
            m_texture_set_list_visible = UserPrefs.GetBool("texture_set_list_vis", false);
            m_uv_editor_visible        = UserPrefs.GetBool("uv_editor_vis", false);

#if !PUBLIC_RELEASE
            Overload.Perforce.m_cached_username   = UserPrefs.GetString("m_cached_username", string.Empty);
            Overload.Perforce.m_cached_clientname = UserPrefs.GetString("m_cached_clientname", string.Empty);
#endif // !PUBLIC_RELEASE

            m_mm_edit_type = (EditMode)UserPrefs.GetInt("mm_edit_type", (int)m_mm_edit_type);
            m_mm_op_mode   = (OperationMode)UserPrefs.GetInt("mm_op_mode", (int)m_mm_op_mode);

            //Read texture collections
            int num_texture_collections = UserPrefs.GetInt("num_texture_collections", 0);
            for (int c = 0; c < num_texture_collections; c++)
            {
                TextureCollections.Add(new TextureCollection(UserPrefs.GetString("texture_collection_" + c), true));
            }
        }