} //}}} public void EditProfile(string profileName) // {{{ { // Cannot Edit the Global profile {{{ /*{{{ * if(profileName == Globals.MENU_GLOBAL_PROFILE) * { * if( Environment.UserInteractive ) * MessageBox.Show("Cannot Edit the Global profile's properties", "", MessageBoxButtons.OK); * * return; * } * }}}*/ //}}} // CHECK PROFILE NAME .. (NEW OR EXISTING) {{{ ProfileSearcher Searcher = new ProfileSearcher(); ProfileProperties PProp = new ProfileProperties(); //}}} // [PProp DIALOG BOX] .. f(New menu entry) .. f(profile name .. from ui.D_Profiles.Text) {{{ bool bNewProfile = (profileName == Globals.MENU_NEW_PROFILE) ; CurrentProfileName = bNewProfile ? "New" : Searcher.ProfileSearchByName(ProfileList, ui.get_D_Profiles_Text()); PProp.EditProfile(CurrentProfileName); //}}} bool clearProfile = false; DialogResult PPropAnswer = PProp.ShowDialog(); // DIALOG [CANCEL] {{{ if (PPropAnswer != DialogResult.OK) { // if we were creating a new profile switch to the Global profile if (bNewProfile) { SelectProfile(Globals.MENU_GLOBAL_PROFILE); } } //}}} // DIALOG [OK] {{{ else { // [bNewProfile] {{{ if (bNewProfile) { // REJECT ALREADY EXISTING PROFILE NAME {{{ if (Searcher.ProfileSearchByName(ProfileList, PProp.GetProfileNameOnly()) != null) { if (Environment.UserInteractive) { MessageBox.Show("This profile already exists, you should load it first. Changes cancelled.", "", MessageBoxButtons.OK); } ui.set_D_Profiles_Text(Globals.MENU_NEW_PROFILE); } //}}} else { // CREATE NEW PROFILE {{{ ui.set_D_Profiles_Text(CurrentProfileName); PProp.GetEditedProfile(ref CurrentProfileName, ref clearProfile); ui.add_D_Profiles_Item(CurrentProfileName); ProfileList.Add(CurrentProfileName); _Save_ProfileList_to_Dx1Profiles_dat(); //}}} // [UNASSIGN ALL KEYS] {{{ if (clearProfile) { init_keyMapList(); ProfileManager.SaveProfile(CurrentProfileName, keyMapList); SyncUI.sync("EditProfile"); } else { ProfileManager.SaveProfile(CurrentProfileName, keyMapList); } //}}} } } //}}} // UPDATE SELECTED PROFILE {{{ else { PProp.GetEditedProfile(ref CurrentProfileName, ref clearProfile); if (clearProfile) { //Clear all the currently programmed keys on this profile init_keyMapList(); ProfileManager.SaveProfile(CurrentProfileName, keyMapList); } } //}}} ui.set_B_Delete_Enabled(true); } //}}} } //}}}
} //}}} private bool _LoadProfile(string newProfileName) // {{{ { string caller = "_LoadProfile"; // LOAD PROFILE .. OUT [keyMapList] [keyProgrammer] // .. OUT .. [keyMapList] [keyProgrammer] if (DX1Utility.Debug) { log("_LoadProfile(" + newProfileName + ")"); } // LOAD SELECTED PROFILE {{{ keyMapList = ProfileManager.LoadProfile(newProfileName); if (keyMapList.Count > 0) { ui.MapMacroKeys(caller); log(""); if (newProfileName == CurrentProfileName) { // CLEAR PENDING KEYMAP AND PROFILE COMMIT REQUIREMENTS log("[" + CurrentProfileName + "] RELOADING CURRENT PROFILE"); keyProgrammer.notify_keyMap_commit_done(); keyProgrammer.notify_profile_commit_done(); if (ui.C2_KeyMap_commit.Checked) { ui.set_C2_KeyMap_commit_Checked(false); } if (ui.C1_Profile_commit.Checked) { ui.set_C1_Profile_commit_Checked(false); } } else { // SET PENDING PROFILE COMMIT REQUIREMENTS log("NEW PROFILE LOADED [" + newProfileName + "]"); keyProgrammer.notify_keyMap_PROFILE_LOADED(); if (ui.C2_KeyMap_commit.Checked) { ui.set_C2_KeyMap_commit_Checked(true); } } return(true); } //}}} // LOAD THE DEFAULT MAPPING INTO NEW PROFILE {{{ if (ui.is_FormWindowState_Minimized()) { log("loading Default mappings"); } else if (Environment.UserInteractive) { MessageBox.Show("Error loading profile " + newProfileName + "\n.. loading Defaults.", "", MessageBoxButtons.OK); } if (newProfileName != Globals.MENU_GLOBAL_PROFILE) { ProfileManager.SaveProfile(newProfileName, keyMapList); } return(false); //}}} } //}}}