Author Topic: When exec CodeSnippets.exe, it's auto change Window type  (Read 10968 times)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
When exec CodeSnippets.exe, it's auto change Window type
« on: May 25, 2009, 02:43:16 pm »
When exec CodeSnippets.exe, it's auto change Window type: From Docked to External.
I reset Window type to Docked, and it's ok!
But when i exec CodeSnippets.exe, it's auto change too.
XPSP3.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #1 on: May 25, 2009, 05:08:59 pm »
When exec CodeSnippets.exe, it's auto change Window type: From Docked to External.
I reset Window type to Docked, and it's ok!
But when i exec CodeSnippets.exe, it's auto change too.
XPSP3.


Please give us the "exact" steps to re-create your problem.

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #2 on: May 26, 2009, 12:19:15 am »
Please give us the "exact" steps to re-create your problem.
1. Run codeblocks.exe (is portable: default.conf with the same folder)
2. View - Code snappets, now, Opened the Code Snappets main UI.
3. CodeSnappets: Settings - Options -> Set Window Type to Docked and OK.
4. Quit Codeblocks.exe
5. run codesnippets.exe
6. quit codesnippets.exe (default.conf.cbTemp still exists!)
7. run codeblocks.exe
8. View - Code snappets
Now, CodeSnippets change Window Type to External

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #3 on: May 26, 2009, 08:48:44 pm »
...default.conf.cbTemp still exists!...


Fixed SVN 5611

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #4 on: May 26, 2009, 08:56:28 pm »
Please give us the "exact" steps to re-create your problem.
1. Run codeblocks.exe (is portable: default.conf with the same folder)
2. View - Code snappets, now, Opened the Code Snappets main UI.
3. CodeSnappets: Settings - Options -> Set Window Type to Docked and OK.
4. Quit Codeblocks.exe
5. run codesnippets.exe
6. quit codesnippets.exe (default.conf.cbTemp still exists!)
7. run codeblocks.exe
8. View - Code snappets
Now, CodeSnippets change Window Type to External


Since you've moved both CodeBlocks.exe, CodeSnippets.exe, and CodeSnippets.ini into a single folder, both exe's will use the single copy of CodeSnippets.ini .

Usually, CodeSnippets.exe uses a *copy* of CodeSnippets.ini. You've forced them to use the same file.

Right now, I can think of no solution to this.

So, when running in portable mode, either use the CodeBlocks plugin version of CodeSnippets *or* use the standalone external version. But not both.

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #5 on: May 27, 2009, 04:01:31 am »
So, when running in portable mode, either use the CodeBlocks plugin version of CodeSnippets *or* use the standalone external version. But not both.
Oh. Have any way to made both use?
example: When run codesnippets.exe, it's not modify codesnippets.ini anything, but only read the codesnippets.xml ?

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #6 on: May 27, 2009, 01:20:15 pm »
So, when running in portable mode, either use the CodeBlocks plugin version of CodeSnippets *or* use the standalone external version. But not both.
Oh. Have any way to made both use?
example: When run codesnippets.exe, it's not modify codesnippets.ini anything, but only read the codesnippets.xml ?


No, it doesn't fit the design or intent of the program. However, you have access to the source and can change it as you like.
« Last Edit: May 27, 2009, 01:50:21 pm by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #7 on: June 21, 2009, 07:26:14 am »
Hi, I find a strange problem.
I use the portable CB see:
http://forums.codeblocks.org/index.php/topic,10360.0.html

My codeblocks.exe was located in "F:\cb_svn\src\output"

But the "codesnippets.ini" was located in "F:\"

Is there something wrong?
Or this pulgin can't use the APPDATA related information to store its configuration?

Thanks
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #8 on: June 21, 2009, 02:14:52 pm »
Hi, I find a strange problem.
I use the portable CB see:
http://forums.codeblocks.org/index.php/topic,10360.0.html

My codeblocks.exe was located in "F:\cb_svn\src\output"

But the "codesnippets.ini" was located in "F:\"

Is there something wrong?
Or this pulgin can't use the APPDATA related information to store its configuration?

Thanks


CodeSnippets first looks for its .ini file in the executable folder.

If it doesn't find the .ini file in the executable folder, it uses the location reported by the Configuration Manager.

It knows nothing about APPDATA.
« Last Edit: June 21, 2009, 02:40:06 pm by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #9 on: June 21, 2009, 03:05:50 pm »
Hi, here is the steps to reproduce this problem.

1, unzip a nightly build or build the CB from SVN source. ( a clean CB, with out APPDATA folder)

2, copy CbLauncher.exe to the folder where codeblocks.exe locates. (suppose in "F:\cb_svn\src\output")

3, run CbLauncher.exe

4, then a "codesnippets.ini" will appeared in "F:\"

Any comments? :D, I will report to Biplab.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #10 on: June 22, 2009, 12:08:49 am »
On its first run, CodeBlocks is returning an empty string as the config folder location in OnAttach() for plugins.

CodeSnippets will have to look for the APPDATA envar.

I'll work up a fix for CodeSnippets.


« Last Edit: June 22, 2009, 12:12:20 am by Pecan »

kennedyusa058

  • Guest
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #11 on: June 23, 2009, 08:54:46 am »
I am not so knowledgeable about this matter. So i have to learn it. Thanks for the post. :P

pret auto

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: When exec CodeSnippets.exe, it's auto change Window type
« Reply #12 on: June 23, 2009, 11:21:36 am »
On its first run, CodeBlocks is returning an empty string as the config folder location in OnAttach() for plugins.

CodeSnippets will have to look for the APPDATA envar.

I'll work up a fix for CodeSnippets.




Thanks, I have see the fix in trunk.

By the way, I read the code below
Code: [Select]
wxString ConfigManager::LocateDataFile(const wxString& filename, int search_dirs)
{
    wxPathList searchPaths;

    // user dirs have precedence
    if (search_dirs & sdPluginsUser)
        searchPaths.Add(GetPluginsFolder(false));
    if (search_dirs & sdScriptsUser)
        searchPaths.Add(GetScriptsFolder(false));
    if (search_dirs & sdDataUser)
        searchPaths.Add(GetDataFolder(false));

    // then we have global dirs
    if (search_dirs & sdPluginsGlobal)
        searchPaths.Add(GetPluginsFolder(true));
    if (search_dirs & sdScriptsGlobal)
        searchPaths.Add(GetScriptsFolder(true));
    if (search_dirs & sdDataGlobal)
        searchPaths.Add(GetDataFolder(true));

    // rest of the dirs
    if (search_dirs & sdCurrent)
        searchPaths.Add(::wxGetCwd());
    if (search_dirs & sdConfig)
        searchPaths.Add(GetConfigFolder());
    if (search_dirs & sdHome)
        searchPaths.Add(GetHomeFolder());
    if (search_dirs & sdBase)
        searchPaths.Add(GetExecutableFolder());
    if (search_dirs & sdTemp)
        searchPaths.Add(GetTempFolder());

    // PATH env. var
    if (search_dirs & sdPath)
        searchPaths.AddEnvList(_T("PATH"));

    return searchPaths.FindValidPath(filename);
}

when CB fails to find the *.conf file at first running, it will return an empty string  :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.