 |
|
 |
If you like the switcher then CodeWinPos might be for you too
http://codewinpos.sourceforge.net
|
|
|
|
 |
|
 |
Works really well needs a slight change within the "findFileWithinWorkspace" function.
I have pairs of files in my workspace
OptionsDlg.cpp and OptionsDlg.h
and
AdvOptionsDlg.cpp and AdvOptionsDlg.h
from OptionsDlg.cpp running the macro will load AdvOptionsDlg.h as it's the first one found, the FindText function needs the additional flag "+ dsMatchWord".
Function findFileWithinWorkspace(file)
...
bFound = ActiveDocument.Selection.FindText(file, dsMatchFromStart + dsMatchRegExp + dsMatchWord)
....
Cheers, John.
|
|
|
|
 |
|
|
 |
|
 |
It's useful! thank you! you are very clever!
I love Programming
|
|
|
|
 |
|
 |
Ummmmm, why not just use the "WizardBar Actions" button that's on the WizardBar toolbar in VC++? (All the way on the right side of the WizardBar toolbar.) Isn't that exactly what that button does? i.e. switch from the header to the implementation and back - including jumping to the correct method?
|
|
|
|
 |
|
 |
Hi.
Try out one of the macros on this link: http://codeguru.earthweb.com/devstudio_macros/open_current_header.shtml#ToggleHandCPP
Myself, I'm using the one by Sven Rymenants. This one has a clever search scheme, i.e
it doesn't assume that everybody uses headerfile extension *.h. Some of us actually uses *.hpp as well....
This one seems to work in workspaces containing several projects.
Regards
Rob
|
|
|
|
 |
|
 |
It can also switch to the specific method declaration/definition
See http://www.ee.oulu.fi/~latti/CodeWiz/ReadMe.html
|
|
|
|
 |
|
 |
I'm no expert on these matters, but it seems to work better if
bFound = ActiveDocument.Selection.FindText(file, dsMatchFromStart + dsMatchRegExp)
is replaced with
bFound = ActiveDocument.Selection.FindText(file, dsMatchFromStart + dsMatchWord)
(When I invoked the macro with a file "NumEdit.h", I expected to see
"NumEdit.cpp"; instead i got "FixNumEdit.cpp", which is another file
in my workspace, but certainly not what I wanted!)
Janne
|
|
|
|
 |
|
 |
Hi!
Looks ok, but what if you e.g have a workspace containing two project; Pro01.dsp and Pro02.dsp? So what??
Well I'll explain:
- Pro01 contains the source and header files test01.cpp and test01.hpp, respectively.
- Pro02 happens to contain the same filenames, but this is NOT the same files.
- The file test01.cpp, belonging to Pro02, is the active document. I invoke method HeaderSourceSwitch
in your macro, and guess what happens??... test01.hpp that is owned by Pro01.dsp got focus!!!
- Function "findFileWithinWorkspace" is the problem. Its search scheme terminates on first hit, i.e the
macro might not work properly in workspaces with several projects.
I guess You will figure out a workaround.
Keep up the good work!
Rob
|
|
|
|
 |
|
 |
Bind it to LeftAlt+H
Thank You! Thank you Thank you!!!!
|
|
|
|
 |
|
 |
I like it
|
|
|
|
 |
|
 |
Nice one, but I am already using WndTabs. But what I am searching for is the equivalence for VS.NET. Once you have familiarized with such a extension you will never miss it. Therefore, has someone written a switching macro?
Regards,
Thomas
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
 |
|
|
 |
|
 |
Thank you for this, eh, sophisticated posting
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
 |
|
 |
Use it:
Option Strict Off
Option Explicit Off
Imports EnvDTE
Imports System.Diagnostics
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.ControlChars
Public Module MyVS6Macros
Sub Baces()
'DESCRIPTION: A description was not provided.
'Begin Recording
ActiveDocument.ReplaceText("(", "( ")
ActiveDocument.ReplaceText("( ", "( ")
ActiveDocument.ReplaceText(")", " )")
ActiveDocument.ReplaceText(" )", " )")
ActiveDocument.ReplaceText(" )", " )")
ActiveDocument.ReplaceText("( )", "()")
ActiveDocument.ReplaceText("( (", "((")
ActiveDocument.ReplaceText(") )", "))")
ActiveDocument.ReplaceText("(( (", "(((")
ActiveDocument.ReplaceText(") ))", ")))")
'End Recording
End Sub
Sub Switch()
Dim a As String
Dim b As String
Dim Flag As Integer
Dim Flag1 As Integer
Flag1 = 0
Flag = 1
a = DTE.ActiveDocument.FullName()
tmp = InStr(a, ".cpp")
If tmp Then
b = Left(a, Len(a) - 3) + "h"
Flag1 = 1
Else
tmp = InStr(a, ".h")
If tmp Then
b = Left(a, Len(a) - 1) + "cpp"
Flag1 = 1
End If
End If
If Flag And Flag1 Then
DTE.Documents.Open(b, "Text")
End If
End Sub
End Module
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|
 |
|
 |
Thank you, Pavel, but in the meanwhile I am using Visual Assist .NET. Thank you anyway.
Regards
Thomas
Finally with Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
 |
|
 |
Try this
Public Module SwitchCPPtoH
Sub SwitchCPPtoH()
Dim myDocument As Document
Dim a As String = ActiveDocument.FullName
Dim b As String
Dim Flag = 1
Dim Flag1 = 0
If Err.Number > 0 Then
Err.Clear()
MsgBox("No Active Document", 0, "Error")
Exit Sub
End If
Dim tmp As String = InStr(a, ".cpp")
If tmp Then
b = Left(a, Len(a) - 3) + "h"
Flag1 = 1
Else
tmp = InStr(a, ".h")
If tmp Then
b = Left(a, Len(a) - 1) + "cpp"
Flag1 = 1
End If
End If
For Each myDocument In Application.Documents
If myDocument.FullName = b Then
myDocument.Activate()
Flag = 0
Exit For
End If
Next
If Flag And Flag1 Then
DTE.ItemOperations.OpenFile(b)
If Err.Number > 0 Then
Err.Clear()
MsgBox("Document not found.", 0, "Error")
Exit Sub
End If
End If
End Sub
End Module
|
|
|
|
 |
|
|
 |
|
 |
Thanks, but I switched to C# several years ago. No more header files...
Regards
Thomas
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
 |
|
 |
Just switched to VS 2005, but still using C++ and MFC
But I missed this macro and spent a long time finding a solution for playing with header files. Hopefully the link will make the search quicker for others.
|
|
|
|
 |