Hi Support,
This is kind of extension to : viewtopic.php?t=39258
When closing my application I'm using IPXV_Inst::SaveUserSettings to save user settings to a file on disk.
When launching my application and calling IPXV_Inst::Init I'm specifying the pUserSettingsSrc of the above saved settings file.
All works as expected.
I've now included some .oxt dictionaries inside "pxv.DLL\Common\Dictionaries" and they get loaded and displayed inside spell checker settings list of dictionaries.
Upon Init, if the pUserSettingsSrc file does exists (so SaveUserSettings created it before .oxt's existed) - none of dictionaries will be enabled in "Spell Checker Settings". A user must manually enable at least one for the SpellChecker to work.
Note that before the "last call" to SaveUserSettings there were no loaded dictionaries (because I was not including *.oxt files).
I guess when Init is called - and the saved user settings file exist - you somehow treat it as if the user has manually disabled all loaded dictionaries (even though there were no dictionaries loaded).
If the pUserSettingsSrc file does NOT exists (let's say "first run") - at least one dictionary will be magically pre-enabled in "Spell Checker Settings".
My conclusion: when Init is called if the pUserSettingsSrc does not exist, and there's at least one loaded oxt) you somehow pre-enable one dictionary - I guess you are looking into Windows locale or something like that.
If I'm correct (?) - can you make it so that when Init reads user settings and if none of the dictionaries is enabled - and there are now some oxt's loaded - pre-enable one (as if the settings file did not exist).
SaveUserSettings should (I guess) store a different value for "enabled dictionaries" if no dictionaries are loaded ("null" or "-1") vs there are dictionaries loaded but none enabled ("0").
p.s.
Am hoping above is clear enough
-žarko
SpellChecker pre-enabled loaded dictionaries / IPXV_Inst::Init (user settings) / SaveUserSettings SOLVED
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: SpellChecker pre-enabled loaded dictionaries / IPXV_Inst::Init (user settings) / SaveUserSettings
Hi Zarko.
I can suggest another way, slightly complicated, but should work well for you:
1. create ICab-object and load your pUserSettingsSrc-file into it.
2. then save this cab back to the pUserSettingsSrc-file.
3. then pass this file to pxvInst.Init()
===
HTH.
Sounds too artificial behavior for regular EU app where end-user must have a clear decision about which dictionaries he needs to use...can you make it so that when Init reads user settings and if none of the dictionaries is enabled - and there are now some oxt's loaded - pre-enable one (as if the settings file did not exist).
I can suggest another way, slightly complicated, but should work well for you:
1. create ICab-object and load your pUserSettingsSrc-file into it.
Code: Select all
ICab cab = auxInst.CreateEmptyCab();
cab.Load(userSettingsSrcStream);
plugData = cab.Root["PluginsData"];
spID = "F05E0BD3-568B-4E87-B752-6FF01A294B39";
spData = plugData.Item(spID);
if (spData == null)
spData = plugData.Insert(spID, dt_Dictionary);
spDictsArr = spData.Item("Dicts");
if (spDictsArr == null)
spDictsArr = spData.Insert("Dicts", dt_Array);
spDictsArr.Add().v = "a\" + oxt_file_name + ".0.0"; // ex: "a\anylang.oxt.0.0",
// the "\a" means 'application's dictionary, located in inside ProgramFiles', also "\u" means 'user's dictionary located in user's roaming folder'
// the "0.0" means <dictionaryIndex>.<languageIndex>, because oxt file may contain many_dictionaries * many_languages, technically.
3. then pass this file to pxvInst.Init()
===
HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: SpellChecker pre-enabled loaded dictionaries / IPXV_Inst::Init (user settings) / SaveUserSettings
Hi Vasyl,
I get "Unspecified error" for "cab.Load(userSettingsSrcStream, [true|false]);"
For IStream I'm using the same approach when, for example, loading a PDF as IStream (for IPXV_MainFrame.OpenDocFrom).
Any idea?
p.s.
I'm opening the file using GENERIC_READ or GENERIC_WRITE / FILE_SHARE_READ or FILE_SHARE_WRITE.
Edit: I've tried in C# using the below code: same error:
-žarko
I get "Unspecified error" for "cab.Load(userSettingsSrcStream, [true|false]);"
For IStream I'm using the same approach when, for example, loading a PDF as IStream (for IPXV_MainFrame.OpenDocFrom).
Any idea?
p.s.
I'm opening the file using GENERIC_READ or GENERIC_WRITE / FILE_SHARE_READ or FILE_SHARE_WRITE.
Edit: I've tried in C# using the below code: same error:
Code: Select all
PDFXEdit.IAFS_Name thePath = fsInst.DefaultFileSys.StringToName(... saved_existing_settings_file...);
int openFileFlags = (int)(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read | PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Write | PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_FullCache | PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_OpenExisting);
PDFXEdit.IAFS_File theFile = thePath.FileSys.OpenFile(thePath, openFileFlags);
PDFXEdit.IStream stream = theFile.GetStream();
PDFXEdit.IAUX_Inst auxInst = (PDFXEdit.IAUX_Inst)pdfCtl.Inst.GetExtension("AUX");
PDFXEdit.ICab cab = auxInst.CreateEmptyCab();
try
{
cab.Load(stream, false);
}
catch (Exception ex)
{
int hr = Marshal.GetHRForException(ex);
string err = auxInst.FormatHRESULT(hr);
//"Unspecified error"
}
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: SpellChecker pre-enabled loaded dictionaries / IPXV_Inst::Init (user settings) / SaveUserSettings
Sorry, it was my mistake there, the file you get from PXV_Inst.SaveUserSetting - is encrypted for user safety purposes. So you cannot open it just via cab.Load(). But you may use another and simpler way: after PXV_Inst::Init(lastUserSettings) and just before loading of plugins(and spellcheck-plugin too) you may access directly to the app's settings via pdfCtl.Inst.Settings object and change it:I get "Unspecified error" for "cab.Load(userSettingsSrcStream, [true|false]);"
plugData = pdfCtl.Inst.Settings.Root["PluginsData"];
...
HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: SpellChecker pre-enabled loaded dictionaries / IPXV_Inst::Init (user settings) / SaveUserSettings SOLVED
Hi Vasyl,
Works like a charm
-žarko
Works like a charm
-žarko
- Dimitar - Tracker Supp
- Site Admin
- Posts: 1797
- Joined: Mon Jan 15, 2018 9:01 am