Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Active GoTo v4


  • Please log in to reply
85 replies to this topic
toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005

Great great great. Will you support seperate checkboxes in the future or do you dislike the idea?

Currently I see no benefit that justifies them, the interface will get more checkboxes, which will be too many for my taste (And I like GUIs!). Handling will get worse too. Please work with the current version if you feel after a month that you still miss it, we'll have to find a way to make it work smoothly. A combobox is no option for instance, radio buttons neither. But maybe you have an idea. There are many states that should be covered:
SHOW:
- all
- subroutines
- functions
- hotkeys
- hotstrings

Of cause you could combine the hotstuff to one item.
Of if you have individual checkboxes for each it will decrease to three CheckBoxes:
- subroutines
- functions
- hotstuff
I compressed two of them in a single checkbox. And I rarely use them. Please see for yourself how often you use such a feature. Searching is much faster then togglingthrough the checkbox.

I have a couple of questions. You parse the file from disk because its hard to get the text directly from the editor? Is that right? What exactly is the problem here? Editors behave to different to find a solution that works on all?

Methods to get the text from window is slow and not reliable. At least that is what has been said and I couldn't prove it wrong. Rajat came up with the idea to just get it from disc. And since it is fast it doesn't matter to my any more. But if you know a better solution, post a prototype.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006
Here are two proposals on how it could look. One is without offset. I see that it can be usefull for very long scripts but filtering should be able to cut the amount of entries so that you don't lose the overview even on 5000+ lines scripts. well its just a proposal.
#SingleInstance force
Gui, Margin, 2, 2
Gui,Add,Edit,w120 r1 ,
Gui,Add,Checkbox,x+4 yp+4,Show Only
Gui,Add,CheckBox,x2 y30,Label
Gui,Add,CheckBox,x+2,Func
Gui,Add,CheckBox,x+2,HKey
Gui,Add,CheckBox,x+2,HString
Gui,Show, center,Proposal2
Gui,2:Margin, 2, 2
Gui,2:Add,Edit,w120 r1 ,
Gui,2:Add,Checkbox,x+4 yp+4,Show Only
Gui,2:Add,CheckBox,x2 y30,L
Gui,2:Add,CheckBox,x+2,F
Gui,2:Add,CheckBox,x+2,HK
Gui,2:Add,CheckBox,x+2,HS
Gui,2:Add,Text,x+2,Offset:
Gui,2:Add,Edit,x+2 yp-3 w35 r1
Gui,2:Show, center,Proposal

But if you know a better solution, post a prototype.

I allready started to investigate it but i have to wait until Chris responds to this.
http://www.autohotke...topic14768.html

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
I saw that post.

Thanks for the proposals. What would be the functionality behind the "Show Only" CheckBox? Same as current Filter?
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006

I saw that post.

Can you confirm the bug?

What would be the functionality behind the "Show Only" CheckBox? Same as current Filter?

Yeah i just renamed it. Filter felt somehow nondescriptive. :p

Btw do the other editors support goto thru the commandline? Because ConTEXT does. ConTEXT.exe c:\path\to\file.ahk /gColumn:Line.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
not that I know of. Can you test it? is it fast? I will look at PSPad.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
I had a look at the documentation of SciTE and PSPad. They both seem to support a GoTo command line parameter. But they normally combine them with an open document command line parameter. Besides that ActiceGoTo must know the path to the editor exe I wonder what happens if such an open and goto command line will react on a document which has changed since last save. Will it discrad the changes, open it again and goto that line. That would be a desaster. How should the editor know to which window it should apply the goto if you have more then one instance running. Will it open another instance?
It seems more complicated and errorprone to me then the current approach. And I do not mind the short flickering of the goto window with the current approach.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006

I had a look at the documentation of SciTE and PSPad. They both seem to support a GoTo command line parameter. But they normally combine them with an open document command line parameter. Besides that ActiceGoTo must know the path to the editor exe I wonder what happens if such an open and goto command line will react on a document which has changed since last save. Will it discrad the changes, open it again and goto that line. That would be a desaster.

The document is not saved nor reloaded if you use this command on context or notepad++. The editors will detect that the file is allready open and just jump to the line.

How should the editor know to which window it should apply the goto if you have more then one instance running. Will it open another instance?

Well in ConTEXT and Notepad++ you cannot open a document twice.

It seems more complicated and errorprone to me then the current approach. And I do not mind the short flickering of the goto window with the current approach.

Well i just wanted to mention it incase you didn't kow and might like it. On my hand, if the time comes i'll investigate it further.

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006
Ok now that Chris has shown me my stupidity i investigated the issue on getting text from the control rather than reading a file.
It turns out its pretty easy in case of context and notepad++ and SciTE(probably other scintilla based editors too).
mbutton::
;;;;Note TrayTip shows only the first  265 characters.
traytip,, % GetTextFromControl()
return

GetTextFromControl()
{
    WinGet, ProcName , ProcessName, A
    if ProcName = Notepad.exe
        ControlGetText, text ,Edit1, A
    else if ProcName = ConTEXT.exe
        ControlGetText, text ,TConTEXTSynEdit1, A
    else if regexmatch(ProcName, "i)(?:Sc(?:\d+|iTE))|(?:notepad(?:\+\+|2)).exe") 
        ControlGetText, text ,Scintilla1, A
    return (text ? text : "")
}
Edit:
Added more editors. The only one that is missing from the ones you support is pspad.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
I tried it shortly with PSPad. One problem that occurs is that the code text has different ClassNN for each tab (PSPad opens multiple files in tabs) and depending on if the log window has been opened or not they start with TPSSynEdit1 or TPSSynEdit2. From there on I get NNs that change or stay constant when I flip around the tabs. Very funny, but not reliable.

I will test to use command line parameter for goto.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006
Well P"o"SPad just sucks. Tested it and its not possible to get reliable info.
If log is not shown the control is PSSynEdit1
If its shown the important control is PSSynEdit2
If you open the FTP window it is PSSynEdit3
I suspect this goes on whenever you open a new window that uses the PSSynEdit class. But acctual Edits where you type your code in are not causing this behavior.
I am thinking about a fallback mode where if active editor is PSPad then read the file from disk else get text from control.
Or one could use mouse get pose and check if its a PSSynEdit under the mouse, and use this control. This has 2 disadvantages. 1.)If mouse is over the log window you get wrong text. 2.) If mouse is over an other controlclass then PSSynEdit you get not info at all.

Regarding the commandline issue.
I tested a bit with scite and this editor is not usable with this. It opens new instances of itself and stuff.
How about creating a function that uses different way depending on the editor?

newrui
  • Guests
  • Last active:
  • Joined: --
May we have support for EditPlus? Or could you show me how to add it myself?

I tried to add the following, it recognizes EditPlus but doesn't grab any functions/subs.

EditorTitelRegEx =         
  (LTrim Comments 
    ^PSPad(?: - \[)?(?P<Name>.*?)(?P<UnSaved> \*)?(?: R/O)?\]?$   ;PSPad 
    ^(?P<Name>.*?) (?P<UnSaved>[-*]) SciTE$                       ;SciTE 
    ^Notepad\+\+ - (?P<Name>.*?)$                                 ;Notepad++ 
    ^(?P<UnSaved>\*)?(?P<Name>.*?)(?: \(Read only\))? - Notepad2$ ;Notepad2 
    ^ConTEXT(?: - \[)?(?P<Name>.*?)(?P<UnSaved> \*?#?)?(?: \[ReadOnly\])?\]?$ ;ConTEXT
    EditPlus                                                      ;EditPlus 
  ) 
;Class or Window Title of GoTo Window for the different editors
GotoWinClassOrTitle =      
  (LTrim Comments 
     ahk_class TfGotoLine     ;PSPad 
     ahk_class #32770         ;SciTE 
     ahk_class #32770         ;Notepad++ 
     ahk_class #32770         ;Notepad2 
     ahk_class TForm          ;ConTEXT 
     ahk_class #32770         ;EditPlus 
  ) 
;ShortCut for GoTo in Editor, in case it is different from Ctrl+g
GotoShortCut =
  (LTrim Comments 
     ^g     ;PSPad 
     ^g     ;SciTE 
     ^g     ;Notepad++ 
     ^g     ;Notepad2 
     ^g     ;ConTEXT 
     ^g     ;EditPlus 
  ) 


toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Dear newrui,

You have to write an RegEx (the strings in EditorTitelRegEx) for the Title of your EditPlus Editor. The title has to contain the full path of the currently opened file. Otherwise it will not work.

If you have no experience with it, please post the exact titles of:
1) When the editor is open and has no file open, or it is empty
2) When a saved file is open
3) When the file got changed but isn't saved yet.
4) When a file that is read only is open
From these title we can dereive the RegEx for EditPlus.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

newrui
  • Guests
  • Last active:
  • Joined: --
Hello Toralf,

I just started learning RegEx, but I have a hard time comprehending a long string of RegEx and figuring out what it is that Active GoTo is looking for. I'd appreciate a little help :)

1) EditPlus or ahk_class Afx:400000:8:10011:0:7800917
2) EditPlus - [C]
3) EditPlus - [C]
4) EditPlus - [C] (same but the tab browsing icon looks different)

Let me know if i can offer further info.

Thanks!

Ray

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Then please try this:
^EditPlus(?: - \[)?(?P<Name>.*?)(?P<UnSaved> \*)?\]?$   ;EditPlus
Please post the result
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

newrui
  • Guests
  • Last active:
  • Joined: --

Then please try this:

^EditPlus(?: - \[)?(?P<Name>.*?)(?P<UnSaved> \*)?\]?$   ;EditPlus
Please post the result


Thanks! It works!

I do have a small favor to ask though. In the next update, may we have a toggle setting for just functions and subroutines? Also can we have Active GoTo to remember that setting for next session?