Author Topic: Some problems with src/associations.cpp and dlgEnvironmentSettings  (Read 6200 times)

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
I just tried to compile the current svn-version (revision 1477) on linux, but there are some problems:

In revision 1459 the files src/associations.* were added to the projekt and in revision 1464 they were added to the autotools build system. But as these files are (only?) dealing with file assosiations and thus are 100% windows-dependent it is not possible to compile src/associations.cpp on linux (and it would make no sense either). Thus I had to remove src/associations.cpp from src/Makefile.am. The next problem is then that the environment-settings-dialogue uses some functions from src/associations.cpp even on Linux. I don't see much sense in doing so and think that these functions should be disables on linux with an #ifdef __WXMSW__... around them as it is always done in src/app.cpp. (The lines in question should be 79/80 and 122 in the file 'src/environmentsettingsdlg.cpp').

But there is another issue with this dialogue:
XRCCTRL(*this, "txtBatchBuildsCmdLine", wxTextCtrl) seems to return a zero-pointer which makes Code::Blocks crash. According to the file 'src/resources/env_settings.xrc' a text-box-control named "txtBatchBuildsCmdLine" should exist. After removing all lines for "txtBatchBuildsCmdLine" in the constructor of 'EnvironmentSettingsDlg' Code::Blocks displays the dialogue but the tab where the text-box should be placed on is completely missing. I have no idea why this happens but could this explain the problem?
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #1 on: December 09, 2005, 03:49:59 pm »
Yes, I haven't done a linux build lately so what you 're saying about associations.* is correct. I 'll fix it a little later.

But there is another issue with this dialogue:
XRCCTRL(*this, "txtBatchBuildsCmdLine", wxTextCtrl) seems to return a zero-pointer which makes Code::Blocks crash. According to the file 'src/resources/env_settings.xrc' a text-box-control named "txtBatchBuildsCmdLine" should exist. After removing all lines for "txtBatchBuildsCmdLine" in the constructor of 'EnvironmentSettingsDlg' Code::Blocks displays the dialogue but the tab where the text-box should be placed on is completely missing. I have no idea why this happens but could this explain the problem?

Run:
Code
make clean-zipfiles
make
make install

so that resource zips get updated.
Resource zips and PCH should be auto-regenerated when needed but I haven't implemented this yet in autotools. I will though...
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #2 on: December 09, 2005, 03:55:38 pm »
Associations.* problems should be fixed now (revision 1478).
I haven't built it in linux yet, but it should work.
Be patient!
This bug will be fixed soon...

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #3 on: December 09, 2005, 04:40:24 pm »
Thanks for the tip with 'make clean-zipfiles' - Code::Blocks doens't crash anymore.

But there is still one problem left with your fix: Now 'src/associations.h' is no longer included in 'src/environmentsettingsdlg.cpp' on linux as the functions declared in that header-file are not necessary on linux. But in this header-file the macro 'DEFAULT_BATCH_BUILD_ARGS' is defined, too. And this macro is still used by 'src/environmentsettingsdlg.cpp' in line 57 and thus the result is a compiler error.

I see two reasonable solutions for that:
- Remove the whole file-associations-stuff from the linux-build as it is simply needless on linux.
- Include 'src/associations.h' in 'src/environmentsettingsdlg.cpp' even in the linux build. This header file will define the needed macro and will declare some (unnecessary) functions. Although these functions are not defined anywhere there is no problem because these functions will not get used. This solutions may be some kind of dirty but it is really simple. ;)

Perhaps, there is even a third way: I don't know where the macro 'DEFAULT_BATCH_BUILD_ARGS' is used, but if the file 'src/environmentsettingsdlg.cpp' is the only place then we could just move the macro there.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #4 on: December 09, 2005, 06:47:25 pm »
that macro ? is relatively new : today by Thomas : rev 1474 :

associations.cpp : replace _T("...") with DEFAULT_BATCH_BUILD_ARGS


Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #5 on: December 09, 2005, 06:49:56 pm »
Before :

       wxString batchbuildargs = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/batch_build_args"), _T("/na /nd /ns"));

After :
       wxString batchbuildargs = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/batch_build_args"), DEFAULT_BATCH_BUILD_ARGS);


Maybe that macro should only be in the cpp file ??

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #6 on: December 09, 2005, 06:53:05 pm »
As I mentioned before: If it is only used in that cpp-file it definitely should be there. This would be the best solution.

EDIT:
I just searched for that macro and found it also in "associations.cpp". Thus it should stay in the header and we should choose another solution for that problem.

Anyway, while searching I noticed another thing:
'Find in Files' didn't find the macro when I demanded it to search in the project files - although the file src/environmentsettingsdlg.cpp was open in the editor, too. And: As I demanded it to search using the path below it said, that there are no files to search in. But after adding a searchmask it worked corectly. Shouldn't be an empty searchmask the same as * (that means, apply to all files)?
« Last Edit: December 09, 2005, 07:02:51 pm by Der Meister »
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #7 on: December 09, 2005, 07:05:16 pm »
Just commited the fix.
Be patient!
This bug will be fixed soon...

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #8 on: December 09, 2005, 07:28:40 pm »
Thanks, it should be alright now.

Just one note to the "Find in files" issue:
If the behaviour I described above is desired, than a little change in line 1561 of the file 'sdk/editormanager.cpp' should do the trick.
Before:
Code
wxArrayString masks = GetArrayFromString(data->searchMask); 
After:
Code
wxArrayString masks = GetArrayFromString((data->searchMask.empty()) ? "*" : data->searchMask);
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

takeshimiya

  • Guest
Re: Some problems with src/associations.cpp and dlgEnvironmentSettings
« Reply #9 on: December 09, 2005, 07:36:40 pm »
Shouldn't be an empty searchmask the same as * (that means, apply to all files)?

I think so.