User forums > Using Code::Blocks

Editor : Swap header/source

(1/1)

LETARTARE:
Leap-15.6

Currently, on a file editor: if you ask to switch to the header/source the requested file opens in an editor all to the right of the open files.
If many files are opened, the layout is incorrectly appropriate.
Is there an option to open it next to the applicant ?

LETARTARE:
Not having found, I wrote a fix to do so.
But when analyzing the code I found an anomaly !

The class managing the exchange is called 'EditorManager' ('editormanager.h' and 'editormanager.cpp')

Also I offer you a test:
I use the renowned version 'cb-13951' (cb51) and 'cb-13958' (cb58)
(or any other available versions)

1- open any version of 'CB' but empty,
2- load the 'cb51.cbp' project, open the file 'include/editormanager.h'
3- load the 'cb58.cbp' project, open the file 'include/editormanager.h'
4- activate the project 'cb51' :
    4-1 select 'cb51::editormanager.h'
    4.2 use in the editor's survey menu' => 'Swap header/source' and validate :
    => a file ''cb51::editormanager.cpp' appears on the right ; it's good

    4.3-  select 'cb58::editormanager.h'
    4.4- use in the editor's survey menu' => 'Swap header/source' and validate :
    => the file 'cb51::editormanager.cpp' is selected !!, it's not the good file

This shows that the verification of belonging to the same project was not carried out in the code

If you could confirm these results, I'll drop off a ticket with the fix.

christo:
Hi @Letartare,

I've implemented an option to open new tab to the right of current tab instead of last in the tab panel : https://github.com/josephch/codeblocks/commit/78858208489bd7ca3cb932ee5596eaee1c4bee27

I think this option is better to limiting this feature to just "swap hearder/source" as it will help to position tabs nearby when opening files when using features like "jump to definition" etc.

Could you please share your thoughts?

@Devs, could you please review and suggest if this is ok to be merged as this introduces a new option?

LETARTARE:
Thank you for being interested in the problem.

The first job is to remove the reported anomaly.
Have you tried the proposed test ?
Does your proposal delete it ?

I looked at your proposal (I didn't test it) :
1- for the modification of 'editor_configuration.xrc': it seems better to choose a 'wxCheckBox' because we only need a boolean to define the exchange either next to the selection or all right.

2- for the modification of the class 'EditorManager' the fact of using 'AddEditorBase(...)', to insert a page, can lead to confusion.
Maybe create an insertion method ? But it is true that in both cases a page is added.

That being the developers will notify.

LETARTARE:
I just dropped off a ticket to correct the first and 2th messages.

Navigation

[0] Message Index

Go to full version