]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/mainframe.cpp
radiant/q3map2: add option to disable engine path and home path
[xonotic/netradiant.git] / radiant / mainframe.cpp
index 6ae00e3d3fabb8620c15c529be2f4647efa68bfe..2eed7bff0c9f6a935cd146ee0410680b0f210a04 100644 (file)
@@ -371,6 +371,59 @@ void setEnginePath( const char* path ){
        }
 }
 
+// Pak Path
+
+CopiedString g_strPakPath[g_pakPathCount] = { "", "", "", "", "" };
+ModuleObservers g_pakPathObservers[g_pakPathCount];
+std::size_t g_pakpath_unrealised[g_pakPathCount] = { 1, 1, 1, 1, 1 };
+
+void Radiant_attachPakPathObserver( int num, ModuleObserver& observer ){
+       g_pakPathObservers[num].attach( observer );
+}
+
+void Radiant_detachPakPathObserver( int num, ModuleObserver& observer ){
+       g_pakPathObservers[num].detach( observer );
+}
+
+
+void PakPath_Realise( int num ){
+       if ( --g_pakpath_unrealised[num] == 0 ) {
+               g_pakPathObservers[num].realise();
+       }
+}
+
+const char* PakPath_get( int num ){
+       std::string message = "PakPath_get: pak path " + std::to_string(num) + " not realised";
+       ASSERT_MESSAGE( g_pakpath_unrealised[num] == 0, message.c_str() );
+       return g_strPakPath[num].c_str();
+}
+
+void PakPath_Unrealise( int num ){
+       if ( ++g_pakpath_unrealised[num] == 1 ) {
+               g_pakPathObservers[num].unrealise();
+       }
+}
+
+void setPakPath( int num, const char* path ){
+       if (!g_strcmp0( path, "")) {
+               g_strPakPath[num] = "";
+               return;
+       }
+
+       StringOutputStream buffer( 256 );
+       buffer << DirectoryCleaned( path );
+       if ( !path_equal( buffer.c_str(), g_strPakPath[num].c_str() ) ) {
+               std::string message = "Changing Pak Path " + std::to_string(num);
+               ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", message.c_str() );
+
+               PakPath_Unrealise(num);
+
+               g_strPakPath[num] = buffer.c_str();
+
+               PakPath_Realise(num);
+       }
+}
+
 
 // App Path
 
@@ -414,16 +467,98 @@ const char* GameToolsPath_get(){
        return g_strGameToolsPath.c_str();
 }
 
-void EnginePathImport( CopiedString& self, const char* value ){
+struct EnginePath {
+       static void Export(const CopiedString &self, const Callback<void(const char *)> &returnz) {
+               returnz(self.c_str());
+       }
+
+       static void Import(CopiedString &self, const char *value) {
        setEnginePath( value );
 }
-typedef ReferenceCaller<CopiedString, void(const char*), EnginePathImport> EnginePathImportCaller;
+};
+
+struct PakPath0 {
+       static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+               returnz( self.c_str() );
+       }
+
+       static void Import( CopiedString &self, const char *value ) {
+               setPakPath( 0, value );
+       }
+};
+struct PakPath1 {
+       static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+               returnz( self.c_str() );
+       }
+
+       static void Import( CopiedString &self, const char *value ) {
+               setPakPath( 1, value );
+       }
+};
+struct PakPath2 {
+       static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+               returnz( self.c_str() );
+       }
+
+       static void Import( CopiedString &self, const char *value ) {
+               setPakPath( 2, value );
+       }
+};
+struct PakPath3 {
+       static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+               returnz( self.c_str() );
+       }
+
+       static void Import( CopiedString &self, const char *value ) {
+               setPakPath( 3, value );
+       }
+};
+struct PakPath4 {
+       static void Export( const CopiedString &self, const Callback<void(const char*)> &returnz ) {
+               returnz( self.c_str() );
+       }
+
+       static void Import( CopiedString &self, const char *value ) {
+               setPakPath( 4, value );
+       }
+};
+
+bool g_disableEnginePath = false;
+bool g_disableHomePath = false;
 
 void Paths_constructPreferences( PreferencesPage& page ){
-       page.appendPathEntry( "Engine Path", true,
-                                                 StringImportCallback( EnginePathImportCaller( g_strEnginePath ) ),
-                                                 StringExportCallback( StringExportCaller( g_strEnginePath ) )
-                                                 );
+       page.appendPathEntry( "Engine Path", true, make_property<EnginePath>(g_strEnginePath) );
+
+       page.appendCheckBox(
+               "", "Do not use Engine Path",
+               g_disableEnginePath
+               );
+
+       page.appendCheckBox(
+               "", "Do not use Home Path",
+               g_disableHomePath
+               );
+
+       for ( int i = 0; i < g_pakPathCount; i++ ) {
+               std::string label = "Pak Path " + std::to_string(i);
+               switch (i) {
+                       case 0:
+                       page.appendPathEntry( label.c_str(), true, make_property<PakPath0>( g_strPakPath[i] ) );
+                       break;
+                       case 1:
+                       page.appendPathEntry( label.c_str(), true, make_property<PakPath1>( g_strPakPath[i] ) );
+                       break;
+                       case 2:
+                       page.appendPathEntry( label.c_str(), true, make_property<PakPath2>( g_strPakPath[i] ) );
+                       break;
+                       case 3:
+                       page.appendPathEntry( label.c_str(), true, make_property<PakPath3>( g_strPakPath[i] ) );
+                       break;
+                       case 4:
+                       page.appendPathEntry( label.c_str(), true, make_property<PakPath4>( g_strPakPath[i] ) );
+                       break;
+               }
+       }
 }
 void Paths_constructPage( PreferenceGroup& group ){
        PreferencesPage page( group.createPage( "Paths", "Path Settings" ) );
@@ -887,7 +1022,7 @@ ColoursMenu g_ColoursMenu;
 
 ui::MenuItem create_colours_menu(){
        auto colours_menu_item = new_sub_menu_item_with_mnemonic( "Colors" );
-       auto menu_in_menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( colours_menu_item ) ));
+       auto menu_in_menu = ui::Menu::from( gtk_menu_item_get_submenu( colours_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu_in_menu );
        }
@@ -999,24 +1134,24 @@ template<bool( *BoolFunction ) ( )>
 class BoolFunctionExport
 {
 public:
-static void apply( const BoolImportCallback& importCallback ){
+static void apply( const Callback<void(bool)> & importCallback ){
        importCallback( BoolFunction() );
 }
 };
 
-typedef FreeCaller<void(const BoolImportCallback&), &BoolFunctionExport<EdgeMode>::apply> EdgeModeApplyCaller;
+typedef FreeCaller<void(const Callback<void(bool)> &), &BoolFunctionExport<EdgeMode>::apply> EdgeModeApplyCaller;
 EdgeModeApplyCaller g_edgeMode_button_caller;
-BoolExportCallback g_edgeMode_button_callback( g_edgeMode_button_caller );
+Callback<void(const Callback<void(bool)> &)> g_edgeMode_button_callback( g_edgeMode_button_caller );
 ToggleItem g_edgeMode_button( g_edgeMode_button_callback );
 
-typedef FreeCaller<void(const BoolImportCallback&), &BoolFunctionExport<VertexMode>::apply> VertexModeApplyCaller;
+typedef FreeCaller<void(const Callback<void(bool)> &), &BoolFunctionExport<VertexMode>::apply> VertexModeApplyCaller;
 VertexModeApplyCaller g_vertexMode_button_caller;
-BoolExportCallback g_vertexMode_button_callback( g_vertexMode_button_caller );
+Callback<void(const Callback<void(bool)> &)> g_vertexMode_button_callback( g_vertexMode_button_caller );
 ToggleItem g_vertexMode_button( g_vertexMode_button_callback );
 
-typedef FreeCaller<void(const BoolImportCallback&), &BoolFunctionExport<FaceMode>::apply> FaceModeApplyCaller;
+typedef FreeCaller<void(const Callback<void(bool)> &), &BoolFunctionExport<FaceMode>::apply> FaceModeApplyCaller;
 FaceModeApplyCaller g_faceMode_button_caller;
-BoolExportCallback g_faceMode_button_callback( g_faceMode_button_caller );
+Callback<void(const Callback<void(bool)> &)> g_faceMode_button_callback( g_faceMode_button_caller );
 ToggleItem g_faceMode_button( g_faceMode_button_callback );
 
 void ComponentModeChanged(){
@@ -1290,44 +1425,44 @@ void Selection_NudgeRight(){
 }
 
 
-void TranslateToolExport( const BoolImportCallback& importCallback ){
+void TranslateToolExport( const Callback<void(bool)> & importCallback ){
        importCallback( GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eTranslate );
 }
 
-void RotateToolExport( const BoolImportCallback& importCallback ){
+void RotateToolExport( const Callback<void(bool)> & importCallback ){
        importCallback( GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eRotate );
 }
 
-void ScaleToolExport( const BoolImportCallback& importCallback ){
+void ScaleToolExport( const Callback<void(bool)> & importCallback ){
        importCallback( GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eScale );
 }
 
-void DragToolExport( const BoolImportCallback& importCallback ){
+void DragToolExport( const Callback<void(bool)> & importCallback ){
        importCallback( GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eDrag );
 }
 
-void ClipperToolExport( const BoolImportCallback& importCallback ){
+void ClipperToolExport( const Callback<void(bool)> & importCallback ){
        importCallback( GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eClip );
 }
 
-FreeCaller<void(const BoolImportCallback&), TranslateToolExport> g_translatemode_button_caller;
-BoolExportCallback g_translatemode_button_callback( g_translatemode_button_caller );
+FreeCaller<void(const Callback<void(bool)> &), TranslateToolExport> g_translatemode_button_caller;
+Callback<void(const Callback<void(bool)> &)> g_translatemode_button_callback( g_translatemode_button_caller );
 ToggleItem g_translatemode_button( g_translatemode_button_callback );
 
-FreeCaller<void(const BoolImportCallback&), RotateToolExport> g_rotatemode_button_caller;
-BoolExportCallback g_rotatemode_button_callback( g_rotatemode_button_caller );
+FreeCaller<void(const Callback<void(bool)> &), RotateToolExport> g_rotatemode_button_caller;
+Callback<void(const Callback<void(bool)> &)> g_rotatemode_button_callback( g_rotatemode_button_caller );
 ToggleItem g_rotatemode_button( g_rotatemode_button_callback );
 
-FreeCaller<void(const BoolImportCallback&), ScaleToolExport> g_scalemode_button_caller;
-BoolExportCallback g_scalemode_button_callback( g_scalemode_button_caller );
+FreeCaller<void(const Callback<void(bool)> &), ScaleToolExport> g_scalemode_button_caller;
+Callback<void(const Callback<void(bool)> &)> g_scalemode_button_callback( g_scalemode_button_caller );
 ToggleItem g_scalemode_button( g_scalemode_button_callback );
 
-FreeCaller<void(const BoolImportCallback&), DragToolExport> g_dragmode_button_caller;
-BoolExportCallback g_dragmode_button_callback( g_dragmode_button_caller );
+FreeCaller<void(const Callback<void(bool)> &), DragToolExport> g_dragmode_button_caller;
+Callback<void(const Callback<void(bool)> &)> g_dragmode_button_callback( g_dragmode_button_caller );
 ToggleItem g_dragmode_button( g_dragmode_button_callback );
 
-FreeCaller<void(const BoolImportCallback&), ClipperToolExport> g_clipper_button_caller;
-BoolExportCallback g_clipper_button_callback( g_clipper_button_caller );
+FreeCaller<void(const Callback<void(bool)> &), ClipperToolExport> g_clipper_button_caller;
+Callback<void(const Callback<void(bool)> &)> g_clipper_button_callback( g_clipper_button_caller );
 ToggleItem g_clipper_button( g_clipper_button_callback );
 
 void ToolChanged(){
@@ -1770,17 +1905,17 @@ void ClipperChangeNotify(){
 }
 
 
-LatchedInt g_Layout_viewStyle( 0, "Window Layout" );
-LatchedBool g_Layout_enableDetachableMenus( true, "Detachable Menus" );
-LatchedBool g_Layout_enablePatchToolbar( true, "Patch Toolbar" );
-LatchedBool g_Layout_enablePluginToolbar( true, "Plugin Toolbar" );
+LatchedValue<int> g_Layout_viewStyle( 0, "Window Layout" );
+LatchedValue<bool> g_Layout_enableDetachableMenus( true, "Detachable Menus" );
+LatchedValue<bool> g_Layout_enablePatchToolbar( true, "Patch Toolbar" );
+LatchedValue<bool> g_Layout_enablePluginToolbar( true, "Plugin Toolbar" );
 
 
 
 ui::MenuItem create_file_menu(){
        // File menu
        auto file_menu_item = new_sub_menu_item_with_mnemonic( "_File" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( file_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( file_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -1820,7 +1955,7 @@ ui::MenuItem create_file_menu(){
 ui::MenuItem create_edit_menu(){
        // Edit menu
        auto edit_menu_item = new_sub_menu_item_with_mnemonic( "_Edit" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( edit_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( edit_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -1877,7 +2012,7 @@ ui::Widget g_toggle_entitylist_item{ui::null};
 ui::MenuItem create_view_menu( MainFrame::EViewStyle style ){
        // View menu
        auto view_menu_item = new_sub_menu_item_with_mnemonic( "Vie_w" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( view_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( view_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -1991,7 +2126,7 @@ ui::MenuItem create_view_menu( MainFrame::EViewStyle style ){
 ui::MenuItem create_selection_menu(){
        // Selection menu
        auto selection_menu_item = new_sub_menu_item_with_mnemonic( "M_odify" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( selection_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( selection_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -2046,7 +2181,7 @@ ui::MenuItem create_selection_menu(){
 ui::MenuItem create_bsp_menu(){
        // BSP menu
        auto bsp_menu_item = new_sub_menu_item_with_mnemonic( "_Build" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( bsp_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( bsp_menu_item ) );
 
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
@@ -2066,7 +2201,7 @@ ui::MenuItem create_bsp_menu(){
 ui::MenuItem create_grid_menu(){
        // Grid menu
        auto grid_menu_item = new_sub_menu_item_with_mnemonic( "_Grid" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( grid_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( grid_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -2079,7 +2214,7 @@ ui::MenuItem create_grid_menu(){
 ui::MenuItem create_misc_menu(){
        // Misc menu
        auto misc_menu_item = new_sub_menu_item_with_mnemonic( "M_isc" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( misc_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( misc_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -2100,7 +2235,7 @@ ui::MenuItem create_misc_menu(){
 ui::MenuItem create_entity_menu(){
        // Brush menu
        auto entity_menu_item = new_sub_menu_item_with_mnemonic( "E_ntity" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( entity_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( entity_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -2113,7 +2248,7 @@ ui::MenuItem create_entity_menu(){
 ui::MenuItem create_brush_menu(){
        // Brush menu
        auto brush_menu_item = new_sub_menu_item_with_mnemonic( "B_rush" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( brush_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( brush_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -2126,7 +2261,7 @@ ui::MenuItem create_brush_menu(){
 ui::MenuItem create_patch_menu(){
        // Curve menu
        auto patch_menu_item = new_sub_menu_item_with_mnemonic( "_Curve" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( patch_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( patch_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -2139,7 +2274,7 @@ ui::MenuItem create_patch_menu(){
 ui::MenuItem create_help_menu(){
        // Help menu
        auto help_menu_item = new_sub_menu_item_with_mnemonic( "_Help" );
-       auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( help_menu_item ) ));
+       auto menu = ui::Menu::from( gtk_menu_item_get_submenu( help_menu_item ) );
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
        }
@@ -2158,7 +2293,7 @@ ui::MenuItem create_help_menu(){
 }
 
 ui::MenuBar create_main_menu( MainFrame::EViewStyle style ){
-       auto menu_bar = ui::MenuBar(GTK_MENU_BAR( gtk_menu_bar_new() ));
+       auto menu_bar = ui::MenuBar::from( gtk_menu_bar_new() );
        menu_bar.show();
 
        menu_bar.add(create_file_menu());
@@ -2305,14 +2440,14 @@ void Manipulators_constructToolbar( ui::Toolbar toolbar ){
 }
 
 ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){
-       auto toolbar = ui::Toolbar(GTK_TOOLBAR( gtk_toolbar_new() ));
+       auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
        gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
        gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
 
        toolbar.show();
 
        auto space = [&]() {
-               auto btn = ui::ToolItem(gtk_separator_tool_item_new());
+               auto btn = ui::ToolItem::from(gtk_separator_tool_item_new());
                btn.show();
                toolbar.add(btn);
        };
@@ -2653,13 +2788,13 @@ void MainFrame::OnSleep(){
 
 
 ui::Window create_splash(){
-       ui::Window window = ui::Window( ui::window_type::TOP );
-       gtk_window_set_decorated( window, FALSE );
-       gtk_window_set_resizable( window, FALSE );
-       gtk_window_set_modal( window, TRUE );
+       auto window = ui::Window( ui::window_type::TOP );
+       gtk_window_set_decorated(window, false);
+       gtk_window_set_resizable(window, false);
+       gtk_window_set_modal(window, true);
        gtk_window_set_default_size( window, -1, -1 );
        gtk_window_set_position( window, GTK_WIN_POS_CENTER );
-       gtk_container_set_border_width( GTK_CONTAINER( window ), 0 );
+       gtk_container_set_border_width(window, 0);
 
        auto image = new_local_image( "splash.png" );
        image.show();
@@ -3126,26 +3261,22 @@ void Layout_constructPreferences( PreferencesPage& page ){
                page.appendRadioIcons(
                        "Window Layout",
                        STRING_ARRAY_RANGE( layouts ),
-                       LatchedIntImportCaller( g_Layout_viewStyle ),
-                       IntExportCaller( g_Layout_viewStyle.m_latched )
+                       make_property( g_Layout_viewStyle )
                        );
        }
        page.appendCheckBox(
                "", "Detachable Menus",
-               LatchedBoolImportCaller( g_Layout_enableDetachableMenus ),
-               BoolExportCaller( g_Layout_enableDetachableMenus.m_latched )
+               make_property( g_Layout_enableDetachableMenus )
                );
        if ( !string_empty( g_pGameDescription->getKeyValue( "no_patch" ) ) ) {
                page.appendCheckBox(
                        "", "Patch Toolbar",
-                       LatchedBoolImportCaller( g_Layout_enablePatchToolbar ),
-                       BoolExportCaller( g_Layout_enablePatchToolbar.m_latched )
+                       make_property( g_Layout_enablePatchToolbar )
                        );
        }
        page.appendCheckBox(
                "", "Plugin Toolbar",
-               LatchedBoolImportCaller( g_Layout_enablePluginToolbar ),
-               BoolExportCaller( g_Layout_enablePluginToolbar.m_latched )
+               make_property( g_Layout_enablePluginToolbar )
                );
 }
 
@@ -3283,25 +3414,25 @@ void MainFrame_Construct(){
        typedef FreeCaller<void(const Selectable&), ComponentMode_SelectionChanged> ComponentModeSelectionChangedCaller;
        GlobalSelectionSystem().addSelectionChangeCallback( ComponentModeSelectionChangedCaller() );
 
-       GlobalPreferenceSystem().registerPreference( "DetachableMenus", BoolImportStringCaller( g_Layout_enableDetachableMenus.m_latched ), BoolExportStringCaller( g_Layout_enableDetachableMenus.m_latched ) );
-       GlobalPreferenceSystem().registerPreference( "PatchToolBar", BoolImportStringCaller( g_Layout_enablePatchToolbar.m_latched ), BoolExportStringCaller( g_Layout_enablePatchToolbar.m_latched ) );
-       GlobalPreferenceSystem().registerPreference( "PluginToolBar", BoolImportStringCaller( g_Layout_enablePluginToolbar.m_latched ), BoolExportStringCaller( g_Layout_enablePluginToolbar.m_latched ) );
-       GlobalPreferenceSystem().registerPreference( "QE4StyleWindows", IntImportStringCaller( g_Layout_viewStyle.m_latched ), IntExportStringCaller( g_Layout_viewStyle.m_latched ) );
-       GlobalPreferenceSystem().registerPreference( "XYHeight", IntImportStringCaller( g_layout_globals.nXYHeight ), IntExportStringCaller( g_layout_globals.nXYHeight ) );
-       GlobalPreferenceSystem().registerPreference( "XYWidth", IntImportStringCaller( g_layout_globals.nXYWidth ), IntExportStringCaller( g_layout_globals.nXYWidth ) );
-       GlobalPreferenceSystem().registerPreference( "CamWidth", IntImportStringCaller( g_layout_globals.nCamWidth ), IntExportStringCaller( g_layout_globals.nCamWidth ) );
-       GlobalPreferenceSystem().registerPreference( "CamHeight", IntImportStringCaller( g_layout_globals.nCamHeight ), IntExportStringCaller( g_layout_globals.nCamHeight ) );
-
-       GlobalPreferenceSystem().registerPreference( "State", IntImportStringCaller( g_layout_globals.nState ), IntExportStringCaller( g_layout_globals.nState ) );
-       GlobalPreferenceSystem().registerPreference( "PositionX", IntImportStringCaller( g_layout_globals.m_position.x ), IntExportStringCaller( g_layout_globals.m_position.x ) );
-       GlobalPreferenceSystem().registerPreference( "PositionY", IntImportStringCaller( g_layout_globals.m_position.y ), IntExportStringCaller( g_layout_globals.m_position.y ) );
-       GlobalPreferenceSystem().registerPreference( "Width", IntImportStringCaller( g_layout_globals.m_position.w ), IntExportStringCaller( g_layout_globals.m_position.w ) );
-       GlobalPreferenceSystem().registerPreference( "Height", IntImportStringCaller( g_layout_globals.m_position.h ), IntExportStringCaller( g_layout_globals.m_position.h ) );
-
-       GlobalPreferenceSystem().registerPreference( "CamWnd", WindowPositionTrackerImportStringCaller( g_posCamWnd ), WindowPositionTrackerExportStringCaller( g_posCamWnd ) );
-       GlobalPreferenceSystem().registerPreference( "XYWnd", WindowPositionTrackerImportStringCaller( g_posXYWnd ), WindowPositionTrackerExportStringCaller( g_posXYWnd ) );
-       GlobalPreferenceSystem().registerPreference( "YZWnd", WindowPositionTrackerImportStringCaller( g_posYZWnd ), WindowPositionTrackerExportStringCaller( g_posYZWnd ) );
-       GlobalPreferenceSystem().registerPreference( "XZWnd", WindowPositionTrackerImportStringCaller( g_posXZWnd ), WindowPositionTrackerExportStringCaller( g_posXZWnd ) );
+       GlobalPreferenceSystem().registerPreference( "DetachableMenus", make_property_string( g_Layout_enableDetachableMenus.m_latched ) );
+       GlobalPreferenceSystem().registerPreference( "PatchToolBar", make_property_string( g_Layout_enablePatchToolbar.m_latched ) );
+       GlobalPreferenceSystem().registerPreference( "PluginToolBar", make_property_string( g_Layout_enablePluginToolbar.m_latched ) );
+       GlobalPreferenceSystem().registerPreference( "QE4StyleWindows", make_property_string( g_Layout_viewStyle.m_latched ) );
+       GlobalPreferenceSystem().registerPreference( "XYHeight", make_property_string( g_layout_globals.nXYHeight ) );
+       GlobalPreferenceSystem().registerPreference( "XYWidth", make_property_string( g_layout_globals.nXYWidth ) );
+       GlobalPreferenceSystem().registerPreference( "CamWidth", make_property_string( g_layout_globals.nCamWidth ) );
+       GlobalPreferenceSystem().registerPreference( "CamHeight", make_property_string( g_layout_globals.nCamHeight ) );
+
+       GlobalPreferenceSystem().registerPreference( "State", make_property_string( g_layout_globals.nState ) );
+       GlobalPreferenceSystem().registerPreference( "PositionX", make_property_string( g_layout_globals.m_position.x ) );
+       GlobalPreferenceSystem().registerPreference( "PositionY", make_property_string( g_layout_globals.m_position.y ) );
+       GlobalPreferenceSystem().registerPreference( "Width", make_property_string( g_layout_globals.m_position.w ) );
+       GlobalPreferenceSystem().registerPreference( "Height", make_property_string( g_layout_globals.m_position.h ) );
+
+       GlobalPreferenceSystem().registerPreference( "CamWnd", make_property<WindowPositionTracker_String>(g_posCamWnd) );
+       GlobalPreferenceSystem().registerPreference( "XYWnd", make_property<WindowPositionTracker_String>(g_posXYWnd) );
+       GlobalPreferenceSystem().registerPreference( "YZWnd", make_property<WindowPositionTracker_String>(g_posYZWnd) );
+       GlobalPreferenceSystem().registerPreference( "XZWnd", make_property<WindowPositionTracker_String>(g_posXZWnd) );
 
        {
                const char* ENGINEPATH_ATTRIBUTE =
@@ -3320,7 +3451,15 @@ void MainFrame_Construct(){
                g_strEnginePath = path.c_str();
        }
 
-       GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) );
+       GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) );
+
+       GlobalPreferenceSystem().registerPreference( "DisableEnginePath", make_property_string( g_disableEnginePath ) );
+       GlobalPreferenceSystem().registerPreference( "DisableHomePath", make_property_string( g_disableHomePath ) );
+
+       for ( int i = 0; i < g_pakPathCount; i++ ) {
+               std::string label = "PakPath" + std::to_string(i);
+               GlobalPreferenceSystem().registerPreference( label.c_str(), make_property_string( g_strPakPath[i] ) );
+       }
 
        g_Layout_viewStyle.useLatched();
        g_Layout_enableDetachableMenus.useLatched();
@@ -3350,7 +3489,7 @@ void MainFrame_Destroy(){
 
 
 void GLWindow_Construct(){
-       GlobalPreferenceSystem().registerPreference( "MouseButtons", IntImportStringCaller( g_glwindow_globals.m_nMouseType ), IntExportStringCaller( g_glwindow_globals.m_nMouseType ) );
+       GlobalPreferenceSystem().registerPreference( "MouseButtons", make_property_string( g_glwindow_globals.m_nMouseType ) );
 }
 
 void GLWindow_Destroy(){