Recent

Author Topic: Merge 2 projects. How to  (Read 7634 times)

anna

  • Sr. Member
  • ****
  • Posts: 426
Merge 2 projects. How to
« on: August 12, 2012, 05:54:18 pm »
Please, tell how to merge 2 projects. For example I have one major project with 4 forms (Form1, Form2 etc.). I also have made another project (in different folder) for testing purposes which contain one Form1. I want to add this Form1 to my major project . How to do this job?

I can add a form (it will Form5) in major project, close Lazarus, then replase unit5.pas and unit5.lfm from another project. But how to replase all instanses (form1 >> form5)?

What is developer recommendation for merging projects?
WinXP SP3 Pro Russian 32-bit (5.1.2600)

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Merge 2 projects. How to
« Reply #1 on: August 12, 2012, 06:08:27 pm »
Quote
Thank you very much, buddy. Please, tell how to merge 2 projects. For example I have one major project with 4 forms (Form1, Form2 etc.). I also have made another project (in different folder) for testing purposes which contain one Form1.
Open a new thread please, this is not related to the thread subject.
Quote
I want to add this Form1 to my major project . How to do this job?
Project Inspector->Add->Add Files->Choose the form1 unit (.pas / .pp, NOT the .lfm)->Add files to project
No , does not work http://img443.imageshack.us/img443/2981/1212wn.png

Besides i want keep not only a code, but a form components.
« Last Edit: August 12, 2012, 06:12:25 pm by anna »
WinXP SP3 Pro Russian 32-bit (5.1.2600)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Merge 2 projects. How to
« Reply #2 on: August 12, 2012, 06:10:24 pm »
I can't see the picture, blocked login. Could you just attach it?

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Merge 2 projects. How to
« Reply #3 on: August 12, 2012, 07:11:36 pm »
come on!
WinXP SP3 Pro Russian 32-bit (5.1.2600)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Merge 2 projects. How to
« Reply #4 on: August 12, 2012, 07:15:07 pm »
Unit name must be unique to each project, it won't work even if they resides on different directory. If you want to share units between projects, give it a meaningful name.

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Merge 2 projects. How to
« Reply #5 on: August 12, 2012, 07:26:44 pm »
Unit name must be unique to each project, it won't work even if they resides on different directory. If you want to share units between projects, give it a meaningful name.
Well, I now have such names, as I write. What can I do with it? Renaming does not help because inside .pas and inside .lfm files there are instanses . I must perform search&replace in all files. But it very long and hard. How developers does not include such option as merging?

Besides, project can contain a resources files. So adding it by hands is madness.
« Last Edit: August 12, 2012, 07:28:30 pm by anna »
WinXP SP3 Pro Russian 32-bit (5.1.2600)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Merge 2 projects. How to
« Reply #6 on: August 12, 2012, 07:37:25 pm »
Quote
What can I do with it? Renaming does not help because inside .pas and inside .lfm files there are instanses . I must perform search&replace in all files. But it very long and hard.
Use File->Save As (say newunit.pas), that would automatically replaces all occurences of the file in the project. Rename the new file to something else for a while (say newunit.pas.bak). Then create a dummy empty file with its previous name (oldunit.pas). Do File->Save As for the other project. Delete the newunit.pas and rename newunit.pas.bak back to newunit.pas). I know it's tiring, but for such a weird requirement, this is normal.
Quote
How developers does not include such option as merging?
Because it's uncommon to do so. If something is to be shared among projects, either a package should be made or one must have such a sharable structure (and it would still suffer a problem when unit name changes). Furthermore, how could it understand your definition of merging (it doesn't sound like merging at all to me anyway, like the one used in version control systems)?

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Merge 2 projects. How to
« Reply #7 on: August 13, 2012, 05:49:24 am »
Well I open unit1.pas in notepad and replase all 'Form1' on 'XDlg', 'unit1' on 'XDlgUnit', then rename unit1.pas to xdlgunit.pas. Then I open in notepad unit1.lfm and replase all 'Form1' on 'XDlg', rename unit1.lfm to xdlgtunit.lfm. Then I've opened in Lazarus my major project Project > Project Inspector > Add > Add Files and added xdlgunit.pas. LFM-file was added automatically.

Thanks for help, but this method is weird. I would like to listen developers.
WinXP SP3 Pro Russian 32-bit (5.1.2600)

 

TinyPortal © 2005-2018