Browser Enhancement idea

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Browser Enhancement idea

Barry Carr-4
Hi,

Would it be possible to mark an instance of a class browser in some way
so that you can distiguish it quickly and easily if you have several
class browsers open at once?

I'll give you an example. Say, you have three browsers open: One where
you are writing your current test; another where you are
writing/refactoring code and a third that you are using to look up
stuff in the image. What I would like to be able to do is mark one of
these browsers in some way so that it will look differnent on the task
bar (and the task bar button stack on WinXP) so that I can identify it
and get to it quickly.

I thought perhaps of being able to change the browsers colour, or
adding some user defined text to the title bar that shows up on the
task bar button. Perhaps, assiging a key-combo to the browser so that
it can be recalled via a key press. Anything that saves trawling
through several windows to get to a particular browser.

--
Cheers

Barry Carr
Ixian Software Components Ltd
Blairgowrie
Perthshire
Scotland


Reply | Threaded
Open this post in threaded view
|

Re: Browser Enhancement idea

Ian Bartholomew-18
Barry,

> Would it be possible to mark an instance of a class browser in some
> way so that you can distiguish it quickly and easily if you have
> several class browsers open at once?

Try the attached result of a quick play.  Dump everything below into a
file named 'bookmark.pac' and then install it using the PackageBrowser.
You will then find two new options on all the Main tool's File menu (not
the best place but this was just a _play_)

Toggle Bookmark (F5) adds/removes a splat to/from the start of the
current shell's caption.

Find Bookmark (F6) brings the next shell that has a splat at the start
of it's caption to the front.  This works OK for one or two bookmarked
shells but gets confused if there are more.  It should probably also
restore minimised shells if they are marked?.

Is that the sort of thing you had in mind?

Ian

| package |

package := Package name: 'bookmark'.

package paxVersion: 0;

basicComment: ''.



package classNames

add: #IdeExtend;

yourself.

package methodNames

add: #Shell -> #findBookmark;

add: #Shell -> #toggleBookmark;

yourself.

package binaryGlobalNames: (Set new

yourself).

package globalAliases: (Set new

yourself).

package allResourceNames: (Set new

yourself).

package setPrerequisites: (IdentitySet new

add: 'Object Arts\Dolphin\IDE\Base\Development System';

add: 'Object Arts\Dolphin\Base\Dolphin';

add: 'Object Arts\Dolphin\MVP\Base\Dolphin MVP Base';

yourself).

package!

"Class Definitions"!

Object subclass: #IdeExtend

instanceVariableNames: ''

classVariableNames: ''

poolDictionaries: ''

classInstanceVariableNames: ''!

"Global Aliases"!



"Loose Methods"!

!Shell methodsFor!

findBookmark

| targets |

targets := (ShellView allInstances select: [:each | each caption
beginsWith: '* '])

asOrderedCollection.

targets remove: self view ifAbsent: [].

targets notEmpty ifTrue: [targets first beActive]!

toggleBookmark

caption := (caption beginsWith: '* ')

ifTrue: [caption copyFrom: 3]

ifFalse: ['* ' , caption].

self view notNil ifTrue: [self view caption: caption]! !

!Shell categoriesFor: #findBookmark!public! !

!Shell categoriesFor: #toggleBookmark!public! !

"End of package definition"!

"Source Globals"!

"Classes"!

IdeExtend guid: (GUID fromString:
'{AFE7A5A6-6D5E-4340-93F1-00A0DA2FD026}')!

IdeExtend comment: ''!

!IdeExtend categoriesForClass!Unclassified! !

!IdeExtend class methodsFor!

extendMenuIn: aBrowser

| menu |

menu := aBrowser view menuBar find: 'File'.

menu

addSeparator;

addCommandDescription:

((ClosedCommandDescription

command: #toggleBookmark

description: 'Toggle Bookmark'

queryBlock:

[:query |

query isEnabled: true.

true]

receiver: aBrowser) acceleratorKeyString: 'F5');

addCommandDescription:

((ClosedCommandDescription

command: #findBookmark

description: 'Find Bookmark'

queryBlock:

[:query |

query isEnabled: true.

true]

receiver: aBrowser) acceleratorKeyString: 'F6').

aBrowser registerAdditionalAccelerators!

initializeAfterLoad

super initializeAfterLoad.

(SmalltalkToolShell allSubclasses copyWith: SmalltalkWorkspaceDocument)

do:

[:each |

each

when: #viewOpened:

send: #onBrowserOpened:

to: self]!

onBrowserClosed: aBrowser

aBrowser view menuBar free!

onBrowserOpened: aBrowser

aBrowser

when: #viewClosed

send: #onBrowserClosed:

to: self

with: aBrowser.

self extendMenuIn: aBrowser! !

!IdeExtend class categoriesFor: #extendMenuIn:!public! !

!IdeExtend class categoriesFor:
#initializeAfterLoad!initializing!public! !

!IdeExtend class categoriesFor: #onBrowserClosed:!event handling!public!
!

!IdeExtend class categoriesFor: #onBrowserOpened:!event handling!public!
!

"Binary Globals"!

"Resources"!


Reply | Threaded
Open this post in threaded view
|

Re: Browser Enhancement idea

Ian Bartholomew-18
Ooops, forgot to change the package on the modified Shell>>caption:
method.

"Filed out from Dolphin Smalltalk XP"!

!Shell methodsFor!

caption: aString

"Set the caption of the receiver to aString"

caption := (caption notNil and: [caption beginsWith: '* '])

ifTrue: ['* ' , aString]

ifFalse: [aString].

self view notNil ifTrue: [self view caption: caption]! !

!Shell categoriesFor: #caption:!accessing!public! !


--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Browser Enhancement idea

Chris Uppal-3
In reply to this post by Barry Carr-4
Barry Carr wrote:

> Would it be possible to mark an instance of a class browser in some way
> so that you can distiguish it quickly and easily if you have several
> class browsers open at once?

You can change the browser's icon (which shows up in the Window's taskbar) with
code like:

    aCHB view largeIcon: anIcon.

I'm currently experimenting with setting the icon in a #classSelected event
handler:

    self view largeIcon: (self actualClass
                                        ifNil: [self class icon]
                                        ifNotNil: [:it | it icon]).

so that the CHB's icon's the same as that of the selected class.  I suspect
that I'll remove it again -- the changing icon makes it harder (at least at
first) to identify CHBs in the taskbar, although it does make them easier to
tell them apart  -- but we'll see.

    -- chris