Re: Math Toolbar patch

2001-05-03 Thread Jean-Marc Lasgouttes

> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Attached is a patch doing this and fixing the other bugs I
Angus> discovered. It does not implement the math toolbar at all and
Angus> can be applied now. Please do so!

I am in the process of applying it.

JMarc



Re: Math Toolbar patch

2001-05-02 Thread Jean-Marc Lasgouttes

> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> * Finally, the
Angus> Layout definition in default.ui should be replaced with
Angus> DropdownList "layout".

An even better suggestion was to use the menu backend for toolbars too
(somehow) and to implement drop down lists as submenus. 

Angus> A common toolbar, always present Toolbar "Common" DropdownList
Angus> "layouts" Icon "file-open" Icon "buffer-write" Icon
Angus> "buffer-print" End

Angus> If text is marked, then show this to the right of Toolbar
Angus> "Common" Toolbar "Cut&Paste" Icon "cut" Icon "copy" Icon
Angus> "paste" End

I don't like that... I would not want icons to appear/disappear when I
move the cursor. Note that currently, the cut-and-paste icons are made
active/inactive as needed. The only problem is that I have not found a
nice way to get visual feedback about that in xforms.

Also, if we use the menu backend for toolbar, we already have OptItem
for items that can appear/disappear as needed.

JMarc



Re: Math Toolbar patch

2001-04-27 Thread Angus Leeming

On Friday 27 April 2001 10:56,  Lars Gullik Bjønnes wrote:
> | Well then, why have a publically accessible WorkArea * workarea() in 
> | BufferView.h? But I agree with you!
> | The only things accessing BufferView::workarea() are the new stuff in 
LyXView 
> | that call
> | width(), height(), xpos(), ypos()
> | and insettext, insettabular that call
> | getClipboard()
> | 
> | Shall I add some wrappers for these calls to BufferView?
> 
> please do. (and in a separate from the toolbar patch please)

Attached is a patch doing this and fixing the other bugs I discovered. It 
does not implement the math toolbar at all and can be applied now. Please do 
so!

Angus

 smallbugfixes.patch.bz2


Re: Math Toolbar patch

2001-04-27 Thread Lars Gullik Bjønnes

Angus Leeming <[EMAIL PROTECTED]> writes:

| Thanks everybody for the feedback. 
| 
| Point 1, for Lars: 
| this IS almost generic. At least as a first attempt it ain't far
| off.

I realize that, and I think we should go all the way from the beginning.

| And for 
| this, I think you/I must extend a special thank you to Jean-Marc for creating| such 
|a general toolbar code. Even if toolbarItem should be a base class so 
| that combox and FL_OBJECTs can exist in the same list...

I think I am going to thank my self as well. But you are right the
Toolbard handling has turned out pretty nice.

| In order to make the stuff completely generic, I think the following points 
| need to be addressed:
| * How to associate Toolbar definitions in default.ui with particular insets? 
| Something like
|   Toolbar "text"
|   ...
|   End
|   Toolbar "math"
|   ...
|   End
| springs to mind.

looks ok to me.

| * This would allow the signals to be replaced with showToolbar("name"), 
| hideToolbar("name").
| * Finally, the Layout definition in default.ui should be replaced with 
| DropdownList "layout".

mmm
 
| Point 2, for Lars:
| > You are removing some of the boundires... LyXView knows about
| > BufferView which knows about WorkArea, LyXView is not supposed to know
| > anything about WorkArea. (and if it already does, that can be
| > considered a bug)
| 
| Well then, why have a publically accessible WorkArea * workarea() in 
| BufferView.h? But I agree with you!
| The only things accessing BufferView::workarea() are the new stuff in LyXView 
| that call
|   width(), height(), xpos(), ypos()
| and insettext, insettabular that call
|   getClipboard()
| 
| Shall I add some wrappers for these calls to BufferView?

please do. (and in a separate from the toolbar patch please)
 
| Point 3, for Dekel, Allan.
| The flicker is annoying isn't it!

Can we avoid this by locking the xforms forms/object?

-- 
Lgb



Re: Math Toolbar patch

2001-04-27 Thread Angus Leeming

Thanks everybody for the feedback. 

Point 1, for Lars: 
this IS almost generic. At least as a first attempt it ain't far off. And for 
this, I think you/I must extend a special thank you to Jean-Marc for creating 
such a general toolbar code. Even if toolbarItem should be a base class so 
that combox and FL_OBJECTs can exist in the same list...

In order to make the stuff completely generic, I think the following points 
need to be addressed:
* How to associate Toolbar definitions in default.ui with particular insets? 
Something like
Toolbar "text"
...
End
Toolbar "math"
...
End
springs to mind.
* This would allow the signals to be replaced with showToolbar("name"), 
hideToolbar("name").
* Finally, the Layout definition in default.ui should be replaced with 
DropdownList "layout".

Point 2, for Lars:
> You are removing some of the boundires... LyXView knows about
> BufferView which knows about WorkArea, LyXView is not supposed to know
> anything about WorkArea. (and if it already does, that can be
> considered a bug)

Well then, why have a publically accessible WorkArea * workarea() in 
BufferView.h? But I agree with you!
The only things accessing BufferView::workarea() are the new stuff in LyXView 
that call
width(), height(), xpos(), ypos()
and insettext, insettabular that call
getClipboard()

Shall I add some wrappers for these calls to BufferView?

Point 3, for Dekel, Allan.
The flicker is annoying isn't it!
If we're thinking of multiple toolbars with only one present at a time, how 
about:

A common toolbar, always present
Toolbar "Common"
DropdownList "layouts"
Icon "file-open"
Icon "buffer-write"
Icon "buffer-print"
End

If text is marked, then show this to the right of Toolbar "Common"
Toolbar "Cut&Paste"
Icon "cut"
Icon "copy"
Icon "paste"
End

If in a text inset then this would go to the right of Common or Cut&Paste:
Toolbar "Text"
Icon "font-emph"
Icon "font-noun"
Icon "font-free"
Separator
Icon "tex-mode"
Separator
Icon "depth-next"
Separator
Icon "math-insert"
Icon "footnote-insert"
Icon "marginalnote-insert"
Icon "figure-insert"
Icon "tabular-insert"
End

If in a math inset
Toolbar "Math"
DropdownList "functions"
Icon "math-insert sqrt"
Icon "math-insert frac"
...
End

Shall I have a go at this next time I find a spare couple of hours?
Angus




Re: Math Toolbar patch

2001-04-26 Thread Allan Rae

On Fri, 27 Apr 2001, Dekel Tsur wrote:

> On Thu, Apr 26, 2001 at 08:58:42PM +0100, Angus Leeming wrote:
> > Attached is a patch creating a Math Toolbar. I'm posting it, rather than
> > commiting it to the repository because I discovered what I think are a couple
> > of bugs in WorkArea and in ToolbarDefaults, but am not very familiar with the
> > code, so think I should seek a second opinion...
>
> Nice. However, as I suspected, the workarea resizing is annoying: when
> you enter/leave a math inset, the screen flickers - it seems that the
> screen is redrawn more than once.

Ideally the resizing should just cause the workarea to crop the top of
its display and keep the rest of the drawing. This should be "croppable"
at any pixel height but I'm nort sure how that will affect the
workareas idea of a current row.  There wouldn't be any flicker then apart
from the magical appearance of the math toolbar.

> How about making the math toolbar replace some of the icon in the standard
> toolbar (e.g. the font icons, figure/tabular/footnote insertion)
> so you won't need to resize the workarea ?

Or just replace one toolbar with the other.  The general toolbar isn't
much use in math anyway.  The 4 general toolbar buttons that are useful in
math mode should just be repeated in the math toolbars definition.

This gets us to the idea of rotating toolbars -- like those available in
Ami Pro all those wonderful years ago, or in Blender or like James Bond's
car number plates.

Then you just need to define a "rotate toolbar" icon that displays the
icon of the toolbar you would switch to when you hold down a mouse button
and move the mouse cursor.  Blender style.  Or use a small menu to list
the names of the toolbars you can switch to.  Ami Pro style.  You wouldn't
normally need to force the change to a different toolbar until we start
offering the user multiple custom toolbars to choose from.

FWIW:
Signal1 showToolbar;

You don't really need a hideToolbar(string) although some implementations
might want to allow several toolbars to clutter up the screen even though
some aren't useful until you are within an appropriate environment.  KLyX
is a good example of this in the Linux world.  Or Word in the Dark
Universe.

Math or general text inside tables would require at most two toolbars:
table + maths
table + general
that is, one outer-context sensitive toolbar and one inner-context.

You could also consider the rotated toolbars as being placed on a stack
and thereby just:

Signal0 popToolbar;

Although this may not work if the user jumps around their document using
the mouse.  I don't think keyboard interaction could trick the stack.

Allan. (ARRae)




Re: Math Toolbar patch

2001-04-26 Thread Lars Gullik Bjønnes

Angus Leeming <[EMAIL PROTECTED]> writes:


| WorkArea's (width, height, xpos, ypos) returned the dimensions of something 
| in between the work_area FL_OBJECT and the entire space taken up by WorkArea. 
| I think that this is wrong and have changed them to return the dimensions of 
| the entire WorkArea. As the only places these methods are called are in the 
| new LyXView::showMathToolbar, hideMathToolbar methods, I think I'm safe, 
| but...

You are removing some of the boundires... LyXView knows about
BufferView which knows about WorkArea, LyXView is not supposed to know
anything about WorkArea. (and if it already does, that can be
considered a bug)

I must also say that a special solution for Math is not completely to
my liking. IMHO it should have been a "generic" solution to add
toolbars of any kind, even the existing one. (Handling in LyXView)

-- 
Lgb



Re: Math Toolbar patch

2001-04-26 Thread Dekel Tsur

On Thu, Apr 26, 2001 at 08:58:42PM +0100, Angus Leeming wrote:
> Attached is a patch creating a Math Toolbar. I'm posting it, rather than 
> commiting it to the repository because I discovered what I think are a couple 
> of bugs in WorkArea and in ToolbarDefaults, but am not very familiar with the 
> code, so think I should seek a second opinion...

Nice.
However, as I suspected, the workarea resizing is annoying:
when you enter/leave a math inset, the screen flickers - it seems that the
screen is redrawn more than once.
How about making the math toolbar replace some of the icon in the standard
toolbar (e.g. the font icons, figure/tabular/footnote insertion)
so you won't need to resize the workarea ?



Math Toolbar patch

2001-04-26 Thread Angus Leeming

Attached is a patch creating a Math Toolbar. I'm posting it, rather than 
commiting it to the repository because I discovered what I think are a couple 
of bugs in WorkArea and in ToolbarDefaults, but am not very familiar with the 
code, so think I should seek a second opinion...

WorkArea's (width, height, xpos, ypos) returned the dimensions of something 
in between the work_area FL_OBJECT and the entire space taken up by WorkArea. 
I think that this is wrong and have changed them to return the dimensions of 
the entire WorkArea. As the only places these methods are called are in the 
new LyXView::showMathToolbar, hideMathToolbar methods, I think I'm safe, 
but...

ToolbarDefaults::read had a final lex.next() call that buggered up the 
reading of subsequent Toolbar definitions. Removing it fixed the bug.

Other than thses points, the patch is pretty straight forward. It shows, 
hides a Math Toolbar when the cursor enters, leaves an InsetFormula and 
resizes the WorkArea appropriately. The Tolbar currently contains only a sqrt 
and a frac, but the functionality is there. 

Note that there's a bug in the mathed stuf that means that the new sqrt, frac 
are displayed only by scrolling the InsetFormula out of sight and back again. 
I think that this is the bug reported earlier by Dekel.

Angus

 mathtoolbar.patch.bz2