Re: LFUN Docs and LFUN Order

2008-01-07 Thread Jürgen Spitzmüller
Pavel Sanda wrote:
 i also wonder whats the meaning of number-counting of the lfuns.
 does anybody use it or can it be deleted too ?

I use it. It's very helpful for debugging.

Jürgen


Re: bug in linguistics module or modules in general

2008-01-07 Thread Jürgen Spitzmüller
rgheck wrote:
 Can you explain exactly what you want here?

A Requires tag, as a counterpart of the Provides tag. See the attached 
patch for how I think the Linguistics module should look like.

This would take care that a certain package is loaded only when it's needed 
(f. ex., in the Linguistics module, only one Char Style needs csquotes), and 
that it is loaded only once, even if another module or LyX itself requires it 
as well (which is not the case if you load the package in the Preamble tag).

I think this would be trivial to implement, using LaTeXFeatures::requires().

 I'm confused about why we're seeing this problem with modules. Modules
 aren't loaded any differently from included files. The only difference
 is that they're dynamically associated with documents rather than
 statically associated with layout files. So I'm inclined to think that
 the bug is elsewhere.

The problem is that we are not yet flexible enough.

 So try this: Take the stuff from the linguistics module and paste it
 into a custom layout file. Do we get the same problem?

Yes. Layouts could probably use the Requires tag as well (albeit the feature 
is probably not as crucial there).

Jürgen
Index: lib/layouts/linguistics.module
===
--- lib/layouts/linguistics.module	(Revision 22335)
+++ lib/layouts/linguistics.module	(Arbeitskopie)
@@ -24,9 +24,7 @@
 		Shape Italic
 		Color Blue
 	EndFont
-	Preamble
-		\usepackage{covington}
-	EndPreamble
+	Requires	  covington
 End
 
 
@@ -49,9 +47,8 @@
 	LatexName subexample
 	LeftMarginXSubexample:
 	LabelString   Subexample:
+	Requires	  covington, enumitem
 	Preamble
-		\usepackage{covington}
-		\usepackage{enumitem}
 		\newenvironment{subexample}{%
 			\begin{example}\begin{enumerate}[leftmargin=1.7em]
 			\renewcommand\theenumi{\alph{enumi}}
@@ -76,8 +73,8 @@
 	MultiPar  true
 	PassThru  true
 	FreeSpacing   true
+	Requires	  covington
 	Preamble
-		\usepackage{covington}
 		[EMAIL PROTECTED]
 		\newenvironment{linggloss}[1]{%
 			\gll #1}
@@ -100,8 +97,8 @@
 	MultiPar  true
 	PassThru  true
 	FreeSpacing   true
+	Requires	  covington
 	Preamble
-		\usepackage{covington}
 		[EMAIL PROTECTED]
 		\newenvironment{lingglosss}[1]{%
 			\glll #1}
@@ -143,8 +140,8 @@
 	LabelString   meaning
 	LatexType command
 	LatexName lingmeaning
+	Requires	  csquotes
 	Preamble
-		\usepackage{csquotes}
 		\newcommand{\lingmeaning}[1]{\enquote*{#1}}
 	EndPreamble
 End


Re: LFUN Docs and LFUN Order

2008-01-07 Thread Abdelrazak Younes

Jürgen Spitzmüller wrote:

Pavel Sanda wrote:

i also wonder whats the meaning of number-counting of the lfuns.
does anybody use it or can it be deleted too ?


I use it. It's very helpful for debugging.


Are you sure GDB won't directly gives the enum value? I think it did 
last time I used that many years ago... Do you use it at the shell or 
within some visual frontend?


Abdel.



Re: LFUN Docs and LFUN Order

2008-01-07 Thread Jürgen Spitzmüller
Abdelrazak Younes wrote:
 Are you sure GDB won't directly gives the enum value? I think it did
 last time I used that many years ago... Do you use it at the shell or
 within some visual frontend?

I don't think of gdb, but of debugging using LyX's -dbg output. Usually, the 
numbers are output there and are helpful especially to debug dispatch 
procedures (also in user's reports).

Jürgen


Re: Disallow embedding of files not in or under current document directory

2008-01-07 Thread Helge Hafting

Bo Peng wrote:

Note also that you can use the same trick for embedded files with
absolute path:

./foo.lyx
/usr/share/figures/bar.png

would become:

temp/foo.lyx
temp/LyX.Embed.Dir.Abs/usr/share/figures/bar.png



How does c:\program files\  fit here? Is there a unique representation
for such filenames?
  

If someone embeds a file with an absolute pathname, then surely
he need a machine with the same directory structure in order to unpack?

That problem is not limited to embed C:\something on windows and unpack
on linux where C: doesn't exist. One might as well embed 
/opt/folder/doc.lyx

and try to unpack on another linux where /opt does not exist. And you
don't usually have write permission on /, so it fails.

Embedding absolute paths might be useful for some, but I think they
had better understand that such a file can't work everywhere and
that they are on their own with any problems this might create.

Those who want to be on the safe side should use relative paths,
and I hope LyX will default to that normally.

Helge Hafting










Re: xdg-open

2008-01-07 Thread Pavel Sanda
  we have our own system for launching viewers for different filetypes, so
  why to pass the control to xdg-open, which (at least on some) systems work
  worse ?
 
 Please submit patches (to xdg-utils) to add support for your own system,
 and I'll do what I can to them integrated into upstream xdg-utils.

thanks for your interest, but i'm afraid this is wontfix and it will be until
there is some _standard_ solution in the whole linux world. afaik there is no
mime support in xdg-open, but just switch which pass control to desktop tools
like gnome-open etc. now - i have no desktop manager, just small window manager,
so fallback to firefox happen. this is not only troublesome, but fairly buggy,
because firefox can not handle all files correctly - for example firefox is
not able to eat files with spaces in file name until you change it to %20, 
so call will fail and just error message is displayed in new browser window.
(btw isn't firefox under gpl, so the mime control can be adopted?)

so i think adding support will mean writing the whole mime-mechanism which is
really not some patch but the whole project - and it should be part of any tool
which lyx use as a parallel to windows start ;) - if you know other solution 
let me know.

what i see know is that simple xdg-open runs just in case you use one of the 
three
dm or have the luck of having the distro which patches it; thats why i think
that either we should drop xdg-open in lyx or detect no dm in the way Per 
Olofsson
suggested.

pavel


Re: LFUN Docs and LFUN Order

2008-01-07 Thread Pavel Sanda
 I don't think of gdb, but of debugging using LyX's -dbg output. Usually, the 
 numbers are output there and are helpful especially to debug dispatch 
 procedures (also in user's reports).

you are right, the numbers should stay there.
pavel


Re: xdg-open

2008-01-07 Thread Helge Hafting

rgheck wrote:


We've been using xdg-open as the first choice for the Debian packages 
and
subsequently the Ubuntu packages for over a year now and didn't 
receive such

a problem report so I suspect that it makes more sense to fix the broken
setup instead of reverting this change.

  
The only way you can get to the browser bit is (a) not to be using 
KDE, Gnome, or XFCE, and (b) not to have a working version of mimeopen 
installed. That's a perfectly sensible setup,
Seems to match what I have. Debian, using icewm for speed, xfce packages 
not

installed and couldn't find any mimeopen stuff.  Still, xdg-open works well
for pdf files, they open in xpdf as expected.


but in that case we shouldn't use xdg-open, I'd guess.

Well - why not?

If the user have xdg-open (in debian's case, the xdg-utils package) then
they should configure it properly. If they don't want to use xdg-open,
then get rid of xdg-utils and LyX configure will pick the next possible 
viewer...


Helge Hafting


Re: LFUN Docs and LFUN Order

2008-01-07 Thread Abdelrazak Younes

Jürgen Spitzmüller wrote:

Abdelrazak Younes wrote:

Are you sure GDB won't directly gives the enum value? I think it did
last time I used that many years ago... Do you use it at the shell or
within some visual frontend?


I don't think of gdb, but of debugging using LyX's -dbg output. Usually, the 
numbers are output there and are helpful especially to debug dispatch 
procedures (also in user's reports).


For this use case a translation to the LFUN command string would be more 
suited.


Abdel.



Re: xdg-open

2008-01-07 Thread Pavel Sanda
 they should configure it properly. If they don't want to use xdg-open,
 then get rid of xdg-utils and LyX configure will pick the next possible 
 viewer...

you can not rid of xdg-utils simply - they are in dependencies of other packages
(eg cups here).

pavel


Re: LFUN Docs and LFUN Order

2008-01-07 Thread Jürgen Spitzmüller
Abdelrazak Younes wrote:
 For this use case a translation to the LFUN command string would be more
 suited.

Probably. But I see no need to break what we have (the question was if the 
numbers should be deleted).

Jürgen


Re: LFUN Docs and LFUN Order

2008-01-07 Thread Abdelrazak Younes

Jürgen Spitzmüller wrote:

Abdelrazak Younes wrote:

For this use case a translation to the LFUN command string would be more
suited.


Probably. But I see no need to break what we have (the question was if the 
numbers should be deleted).


If we are to put some order in the LFUN, the numbers will all change 
every times you insert or delete an LFUN. This is cumbersome and 
probably the reason why new LFUNs were always put at the end of the enum.


Abdel.



Re: LFUN Docs and LFUN Order

2008-01-07 Thread Stefan Schimanski


Am 07.01.2008 um 09:45 schrieb Jürgen Spitzmüller:


Abdelrazak Younes wrote:

Are you sure GDB won't directly gives the enum value? I think it did
last time I used that many years ago... Do you use it at the shell or
within some visual frontend?


I don't think of gdb, but of debugging using LyX's -dbg output.  
Usually, the

numbers are output there and are helpful especially to debug dispatch
procedures (also in user's reports).


Wouldn't an additional verbose iostream operator for the lfun enum  
be enough (if c++ allows that for enums)?


Stefan

Re: r22368 - in /lyx-devel/branches/BRANCH_1_5_X: src/fronten...

2008-01-07 Thread Jean-Marc Lasgouttes
Angus Leeming [EMAIL PROTECTED] writes:

 remove extra menu expansion which causes multiple warnings about shortcuts

 -
 -Menu menu;
 -menubackend_.expand(menubackend_.getMenubar(), menu, 
 owner_-buffer());

 Why not add an isExpanded member to menubackend_, set to true by
 .expand ?

This is not the problem here: due to a random cut-and-paste action, a
new variable is allocated at each iteration and populated with a copy
of the expanded menubar. Then the variable is never used for anything!

JMarc


Re: [patch] add shortcut for numbered formulas

2008-01-07 Thread Jean-Marc Lasgouttes
Uwe Stöhr [EMAIL PROTECTED] writes:

 I would find a toggle numbering button on the toolbar more useful

 Me too. I tried to implement this, but failed. I don't get it to work
 that when the toggle numbering button is activated, the LFUN
 math_display also turns on numbering. Do you have an idea how to do
 this?

The two actions for numbering now properly toggle and disable as
needed. If we had an icon, it could be added to the relevant toolbar.

JMarc


Display problems in LyX-1.6svn

2008-01-07 Thread Helge Hafting

I checked out 1.6 on friday, and noticed some problems:

* Invisible document
Brought up two documents with lyx doc1.lyx doc2.lyx
doc1.lyx seemed normal, but doc2.lyx came up with an empty
main window!  The scrollbar was present though. I scrolled through
half the document, and suddenly the document became visible.
doc2.lyx is the longer document of the two, more text and more paragraphs.

* painting errors
I saw this a couple of times, but can't reproduce reliably:
while typing into the middle of a paragraph, the new text
is painted on top of the old, i.e. the old is not erased first.
So the line gets very black after typing a word or two (this
changes the interword spacing on the whole line, which is
overlayed on top of the old line layout.) When the line
breaking changes, the entire paragraph messes up
the same way. Scrolling a little fixes everything.

Using qt 4.3.2 from debian linux.
Helge Hafting


Re: Display problems in LyX-1.6svn

2008-01-07 Thread Stefan Schimanski

* painting errors
I saw this a couple of times, but can't reproduce reliably:
while typing into the middle of a paragraph, the new text
is painted on top of the old, i.e. the old is not erased first.
So the line gets very black after typing a word or two (this
changes the interword spacing on the whole line, which is
overlayed on top of the old line layout.) When the line
breaking changes, the entire paragraph messes up
the same way. Scrolling a little fixes everything.


Seeing the same for several weeks. But strangely not always.

Stefan


Re: bug in linguistics module or modules in general

2008-01-07 Thread Jean-Marc Lasgouttes
RGH [EMAIL PROTECTED] writes:

 As spitz says: We need a Requires tag.

Yes. Note however that using a DependsOn tag would be a workaround.

JMarc


Re: LyX 1.5 Patch Candidate List #14

2008-01-07 Thread Jean-Marc Lasgouttes
Michael Gerz [EMAIL PROTECTED] writes:

 http://www.lyx.org/trac/changeset/22147 - lasgouttes - fix
 out-of-vector addressing when typesetting UserGuide.

Not relevant for 1.5.

JMarc


Re: Display problems in LyX-1.6svn

2008-01-07 Thread Abdelrazak Younes

Helge Hafting wrote:

I checked out 1.6 on friday, and noticed some problems:


Those probably results from my scrolling work. But I won't have time to 
investigate until next month, sorry about that. But I am sure others can 
help if they have the time (Stefan, Tomaso and Martin are the one I am 
thinking of ;-)).


Abdel.



Re: Bug 4460, Crash opening LaTeXConfig.lyx

2008-01-07 Thread Jean-Marc Lasgouttes
rgheck [EMAIL PROTECTED] writes:

 The reported exception is basic_string::erase. Unfortunately, the
 event and receiver variables are optimized out, so I can't tell what
 event this was.

Do we really have to endure these untraceable exceptions instead of
good old SIGSEGV?

JMarc


1.6svn: File is modified externally when it isn't.

2008-01-07 Thread Helge Hafting

Lyx crashed with an assert:
yx: ../../src/xcb_io.c:182: process_responses: (assertion) «((int) 
(((dpy-last_request_read)) - ((dpy-request))) = 0)» failed.


So I restarted LyX. LyX told me that the copy was newer than the original,
so I choosed the copy. Then I saved, and got the
wrong message about the file being externally modified and did
I really want to save it?

Such a warning is fine when the file _is_ externally modified, but
that was not the case. LyX restored its own automatic backup,
that is internal stuff. :-)

Helge Hafting


1.6svn: Can't extend selection by mouse drag - no autoscrolling

2008-01-07 Thread Helge Hafting

I tried to select more than a screenful of text by mouse.
It doesn't work very well. Dragging the mouse below the main
window will sometimes autoscroll a line or two, but usually
no more than getting the last half-line fully displayed.

There is usually no autoscroll even though there is plenty
of dcoument left to scroll into.

Helge Hafting


Re: [patch] add shortcut for numbered formulas

2008-01-07 Thread Uwe Stöhr

Jean-Marc Lasgouttes schrieb:


The two actions for numbering now properly toggle and disable as
needed. If we had an icon, it could be added to the relevant toolbar.


I can provide an icon, but first want to test it out. What would be the 
definition of the toggle button?
When the numbering is toggled on, inserting a displayed formula should insert a 
numbered fomula.

regards Uwe


1.6svn asserts, backtrace:

2008-01-07 Thread Helge Hafting

I had two documents open, and was writing into a paragraph. Then this
assert happened. It happens now and then, so I was able
to make it happen again and get a trace in gdb:



lyx: ../../src/xcb_io.c:182: process_responses: Forutsetningen 
(assertion) «((int) (((dpy-last_request_read)) - ((dpy-request))) = 
0)» feilet.


Program received signal SIGABRT, Aborted.
[Switching to Thread 0xa63569b0 (LWP 12575)]
0xa7fb7410 in __kernel_vsyscall ()
(gdb) bt
#0  0xa7fb7410 in __kernel_vsyscall ()
#1  0xa70067f5 in raise () from /lib/i686/cmov/libc.so.6
#2  0xa7008181 in abort () from /lib/i686/cmov/libc.so.6
#3  0xa6fffb6e in __assert_fail () from /lib/i686/cmov/libc.so.6
#4  0xa72889bc in ?? () from /usr/lib/libX11.so.6
#5  0xa72f21bc in ?? () from /usr/lib/libX11.so.6
#6  0xa72f2346 in ?? () from /usr/lib/libX11.so.6
#7  0x00b6 in ?? ()
#8  0xa728902f in _XEventsQueued () from /usr/lib/libX11.so.6
#9  0xa72727df in XEventsQueued () from /usr/lib/libX11.so.6
#10 0xa78ae69d in ?? () from /usr/lib/libQtGui.so.4
#11 0x087dc208 in ?? ()
#12 0x0002 in ?? ()
#13 0xa74cc67c in ?? () from /usr/lib/libglib-2.0.so.0
#14 0xa78ae679 in ?? () from /usr/lib/libQtGui.so.4
#15 0xa74cc67c in ?? () from /usr/lib/libglib-2.0.so.0
#16 0xafdd86f8 in ?? ()
#17 0xa745eefb in g_main_context_check () from /usr/lib/libglib-2.0.so.0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


Helge Hafting


Re: [patch] add shortcut for numbered formulas

2008-01-07 Thread Jean-Marc Lasgouttes
Uwe Stöhr [EMAIL PROTECTED] writes:

 Jean-Marc Lasgouttes schrieb:

 The two actions for numbering now properly toggle and disable as
 needed. If we had an icon, it could be added to the relevant toolbar.

 I can provide an icon, but first want to test it out. What would be the 
 definition of the toggle button?
 When the numbering is toggled on, inserting a displayed formula should insert 
 a numbered fomula.

No, what exists is the proper toggling of existing formula (as a whole
or line by line).

We could have a pref setting for numbering new formulas by default,
but I do not think it should be something on the toolbar (people who
really need to change this often should use existing numbering
functions.

JMarc


1.6svn: pasting lyxtext containing branches should create the branches that doesn't exist already

2008-01-07 Thread Helge Hafting

Open two documents, one with branches.
Copy the contents with branches into the other document.
Notice that the branch-boxes are created, but
document-settings shows no branches at all.

This at least causes the problem that one cannot turn branches
on and off, and possibly other internal problems. (Can LyX
save that document in a sane manner?)
Creating the missing branches manually works, the
pasted branches can then be turned on and off as usual.

Helge Hafting


Re: 1.6svn: pasting lyxtext containing branches should create the branches that doesn't exist already

2008-01-07 Thread Abdelrazak Younes

Helge Hafting wrote:

Open two documents, one with branches.
Copy the contents with branches into the other document.
Notice that the branch-boxes are created, but
document-settings shows no branches at all.

This at least causes the problem that one cannot turn branches
on and off, and possibly other internal problems. (Can LyX
save that document in a sane manner?)
Creating the missing branches manually works, the
pasted branches can then be turned on and off as usual.



Please create bugzilla entry for all reports. I'll have a look when I 
find time.


Abdel.



Re: xdg-open

2008-01-07 Thread Sven Hoexter
On Mon, Jan 07, 2008 at 10:15:32AM +0100, Pavel Sanda wrote:

Hi,

  they should configure it properly. If they don't want to use xdg-open,
  then get rid of xdg-utils and LyX configure will pick the next possible 
  viewer...
 
 you can not rid of xdg-utils simply - they are in dependencies of other 
 packages
 (eg cups here).

I feared that it could end this way. Ok now I'm feeling sorry for heaving
pushed this change.

Well let's see what we can do now to mitigate more damage.

I don't know how long it will take to puch some of the mime stuff integrated
in Debian and Fedora(?) and maybe others upstream.
Would it help to revert the patch until that's sorted out of would that only
remove the pressure?

I don't think that it would help a lot to hack parts of the mime detection
or DE detection stuff into the configure.py and make it more complex without
really solving the initial problem I hoped to solve.

So the only to viable options I see are
a) remove the xdg-open calls
aa) and maybe replace them with a list of the distro specific tools like
mimeopen or run-mailcap (pretty long and ugly list ...)
b) try push some changes to xdg-open and hope for a fast adoption rate within
   the Linux distribution oekosystem.

I guess a and aa) would be the faster once.

Did other distributions beside Gentoo break? Maybe some BSD?

Cheers,
Sven



Re: xdg-open

2008-01-07 Thread Jürgen Spitzmüller
Sven Hoexter wrote:
 So the only to viable options I see are
 a) remove the xdg-open calls
 aa) and maybe replace them with a list of the distro specific tools like
     mimeopen or run-mailcap (pretty long and ugly list ...)
 b) try push some changes to xdg-open and hope for a fast adoption rate
 within the Linux distribution oekosystem.

 I guess a and aa) would be the faster once.

I think for now, we should revert revision 22000 (at least the xdg-open part).

Jürgen


Re: xdg-open

2008-01-07 Thread Rex Dieter
Pavel Sanda wrote:

 what i see know is that simple xdg-open runs just in case you use one of
 the three dm or have the luck of having the distro which patches it

perl-mimeinfo and/or run-mailcap looks like a winner for you then.  That's
primarily why I'll be working to get these both integrated into upstream
xdg-utils.

-- Rex




Re: [patch] add shortcut for numbered formulas

2008-01-07 Thread Uwe Stöhr

Jean-Marc Lasgouttes schrieb:


No, what exists is the proper toggling of existing formula (as a whole
or line by line).


This was not what I meant.


We could have a pref setting for numbering new formulas by default,
but I do not think it should be something on the toolbar (people who
really need to change this often should use existing numbering
functions.


But when we have a default setting, we can also have a toggle button in the toolbar. It is more 
useful to be able to toggly numbering in the toolbar, because there are cases where e.g. in 
derivations 10 consecutive formulas are numbered and the next 10 not.


regards Uwe


Re: xdg-open

2008-01-07 Thread Rex Dieter
Sven Hoexter wrote:

 I don't know how long it will take to puch some of the mime stuff
 integrated in Debian and Fedora(?) and maybe others upstream.

I plan on finishing this by the end of the week.  

As an aside, while I'm working on this anyway, anyone with any other
xdg-utils-related patches, suggestions, please let me know.

-- Rex




Re: xdg-open

2008-01-07 Thread Pavel Sanda

 I don't think that it would help a lot to hack parts of the mime detection

DE detection will solve it, but it would uglify the code and could break
anytime DE change something etc.

  So the only to viable options I see are
  a) remove the xdg-open calls

agree with this.

  aa) and maybe replace them with a list of the distro specific tools like
      mimeopen or run-mailcap (pretty long and ugly list ...)

and also i think this should be the worry of distros devs.

  b) try push some changes to xdg-open and hope for a fast adoption rate
  within the Linux distribution oekosystem.

afaik this is going to be longtime job if you want to solve it generally.


but maybe Richard conceive something from the mimeopen stuff.

pavel


Re: xdg-open

2008-01-07 Thread Rex Dieter
Rex Dieter wrote:

 fwiw, mimeopen support was added to fedora's xdg-utils, and I had the
 intention of pushing that upstream, but never got round-tuit.  My bad.

FYI, xdg-utils: perl-mimeinfo support
https://bugs.freedesktop.org/show_bug.cgi?id=13953

-- Rex



Re: xdg-open

2008-01-07 Thread Pavel Sanda
  what i see know is that simple xdg-open runs just in case you use one of
  the three dm or have the luck of having the distro which patches it
 
 perl-mimeinfo and/or run-mailcap looks like a winner for you then.  That's

thats not question of winner for me. i can hardcode my lyx preferences and its
finished. but i care about the other lyx users which dont see under the hood
and previewing starts to work weirdly out of the blue.

 primarily why I'll be working to get these both integrated into upstream
 xdg-utils.

note, that the already proposed patch with the which run-mailcap part
does not help unless we make that package part of lyx requirements.

pavel


Re: xdg-open

2008-01-07 Thread Rex Dieter
Pavel Sanda wrote:

 
 I don't think that it would help a lot to hack parts of the mime
 detection
 
 DE detection will solve it, but it would uglify the code and could break
 anytime DE change something etc.
 
  So the only to viable options I see are
  a) remove the xdg-open calls
 
 agree with this.

Disagree, xdg-open works nicely for a vast number of (lyx) users.  I
consider the class/# of users where xdg-utils doesn't work as nicely to be
the minority, and the focus should be to help fix these exceptional cases,
not regress for everyone.  imo.

-- Rex



Re: xdg-open

2008-01-07 Thread Pavel Sanda
 the minority, and the focus should be to help fix these exceptional cases,

this means to put the whole mime stuff into xdg because there is no promise
that every distro has the mailcap/mime packages. even if you manage to write
such patches it will take some time to push it upstream (i see the Per's patch
was written in 2006) and then back to distros.

so the solution is either make some DE detection in our config scripts or drop 
it from the time being and wait.

 not regress for everyone.  imo.

well now the status is we have regression of 1.5.3 to 1.5.2 for some users.

pavel


Re: xdg-open

2008-01-07 Thread Rex Dieter
Pavel Sanda wrote:

 not regress for everyone.  imo.
 
 well now the status is we have regression of 1.5.3 to 1.5.2 for some
 users.

some = (small) minority, as well as creating a much better user-experience
for the rest.  ok, I'm done (I think I've made my point/opinion as clearly
as I can now without beating it to death).

-- Rex



[patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread Jürgen Spitzmüller
Jürgen Spitzmüller wrote:
 A Requires tag, as a counterpart of the Provides tag.

patch attached.

I guess this needs a layout format increment, right?

Jürgen
Index: src/TextClass.cpp
===
--- src/TextClass.cpp	(Revision 22411)
+++ src/TextClass.cpp	(Arbeitskopie)
@@ -203,7 +203,7 @@
 		break;
 	case MERGE:
 		LYXERR(Debug::TCLASS, Reading input file );
-	  break;
+		break;
 	case MODULE:
 		LYXERR(Debug::TCLASS, Reading module file );
 		break;
@@ -609,6 +609,7 @@
 	IL_NEEDPROTECT,
 	IL_PASSTHRU,
 	IL_PREAMBLE,
+	IL_REQUIRES,
 	IL_END
 };
 
@@ -632,7 +633,8 @@
 		{ multipar, IL_MULTIPAR },
 		{ needprotect, IL_NEEDPROTECT },
 		{ passthru, IL_PASSTHRU },
-		{ preamble, IL_PREAMBLE }
+		{ preamble, IL_PREAMBLE },
+		{ requires, IL_REQUIRES }
 	};
 
 	lexrc.pushTable(elementTags, IL_END);
@@ -647,6 +649,7 @@
 	FontInfo labelfont = inherit_font;
 	ColorCode bgcolor(Color_background);
 	string preamble;
+	vectorstring requires;
 	bool multipar = false;
 	bool passthru = false;
 	bool needprotect = false;
@@ -659,7 +662,7 @@
 		int le = lexrc.lex();
 		switch (le) {
 		case Lexer::LEX_UNDEF:
-			lexrc.printError(Unknown ClassOption tag `$$Token');
+			lexrc.printError(Unknown InsetLayout tag `$$Token');
 			continue;
 		default: break;
 		}
@@ -729,6 +732,12 @@
 		case IL_PREAMBLE:
 			preamble = lexrc.getLongString(EndPreamble);
 			break;
+		case IL_REQUIRES: {
+			lexrc.eatLine();
+			string const packages = lexrc.getString();
+			requires = getVectorFromString(packages);
+			break;
+		}
 		case IL_END:
 			getout = true;
 			break;
@@ -756,8 +765,9 @@
 		// any realization against a given context.
 		labelfont.realize(sane_font);
 		il.labelfont = labelfont;
-		il.bgcolor = bgcolor;		
+		il.bgcolor = bgcolor;
 		il.preamble = preamble;
+		il.requires = requires;
 		insetlayoutlist_[name] = il;
 	}
 
@@ -809,7 +819,7 @@
 		int le = lexrc.lex();
 		switch (le) {
 		case Lexer::LEX_UNDEF:
-			lexrc.printError(Unknown ClassOption tag `$$Token');
+			lexrc.printError(Unknown float tag `$$Token');
 			continue;
 		default: break;
 		}
@@ -909,7 +919,7 @@
 		int le = lexrc.lex();
 		switch (le) {
 		case Lexer::LEX_UNDEF:
-			lexrc.printError(Unknown ClassOption tag `$$Token');
+			lexrc.printError(Unknown counter tag `$$Token');
 			continue;
 		default: break;
 		}
Index: src/Layout.h
===
--- src/Layout.h	(Revision 22411)
+++ src/Layout.h	(Arbeitskopie)
@@ -19,6 +19,9 @@
 #include Spacing.h
 #include support/docstring.h
 
+#include vector
+#include string
+
 namespace lyx {
 
 class Lexer;
@@ -81,6 +84,8 @@
 	///
 	docstring const  preamble() const { return preamble_; }
 	///
+	std::vectorstd::string const  requires() const { return requires_; }
+	///
 	std::string const  latexparam() const { return latexparam_; }
 	///
 	std::string const  innertag() const { return innertag_; }
@@ -250,6 +255,8 @@
 	std::string itemtag_;
 	/// Macro definitions needed for this layout
 	docstring preamble_;
+	/// Packages needed for this layout
+	std::vectorstd::string requires_;
 };
 
 } // namespace lyx
Index: src/insets/InsetFlex.cpp
===
--- src/insets/InsetFlex.cpp	(Revision 22411)
+++ src/insets/InsetFlex.cpp	(Arbeitskopie)
@@ -22,6 +22,7 @@
 #include FuncStatus.h
 #include Cursor.h
 #include support/gettext.h
+#include LaTeXFeatures.h
 #include Lexer.h
 #include Text.h
 #include MetricsInfo.h
@@ -46,6 +47,8 @@
 	: InsetCollapsable(bp, Collapsed, il)
 {
 	name_ = il.name;
+	packages_ = il.requires;
+	preamble_ = il.preamble;
 }
 
 
@@ -136,4 +139,17 @@
 	os  paragraphs().begin()-asString(buf, true);
 }
 
+
+void InsetFlex::validate(LaTeXFeatures  features) const
+{
+	if (!preamble_.empty())
+		features.addPreambleSnippet(preamble_);
+	if (packages_.empty())
+		return;
+	for (vectorstring::const_iterator it = packages_.begin();
+	 it != packages_.end(); ++it) {
+		features.require(*it);
+	}
+}
+
 } // namespace lyx
Index: src/insets/InsetLayout.h
===
--- src/insets/InsetLayout.h	(Revision 22411)
+++ src/insets/InsetLayout.h	(Arbeitskopie)
@@ -15,6 +15,9 @@
 
 #include support/docstring.h
 
+#include vector
+#include string
+
 namespace lyx {
 
 ///
@@ -31,6 +34,7 @@
 	FontInfo labelfont;
 	ColorCode bgcolor;
 	std::string preamble;
+	std::vectorstd::string requires;
 	bool multipar;
 	bool passthru;
 	bool needprotect;
Index: src/insets/InsetFlex.h
===
--- src/insets/InsetFlex.h	(Revision 22411)
+++ src/insets/InsetFlex.h	(Arbeitskopie)
@@ -51,6 +51,8 @@
 		OutputParams const ) const;
 	/// the string that is passed to the TOC
 	virtual void textString(Buffer const , odocstream ) const;
+	///
+	void validate(LaTeXFeatures ) const;
 
 	/// should paragraph indendation be ommitted in any case?
 	bool 

Re: xdg-open

2008-01-07 Thread rgheck

Helge Hafting wrote:

rgheck wrote:


We've been using xdg-open as the first choice for the Debian 
packages and
subsequently the Ubuntu packages for over a year now and didn't 
receive such
a problem report so I suspect that it makes more sense to fix the 
broken

setup instead of reverting this change.

  
The only way you can get to the browser bit is (a) not to be using 
KDE, Gnome, or XFCE, and (b) not to have a working version of 
mimeopen installed. That's a perfectly sensible setup,
Seems to match what I have. Debian, using icewm for speed, xfce 
packages not
installed and couldn't find any mimeopen stuff.  Still, xdg-open works 
well

for pdf files, they open in xpdf as expected.


This is probably because Debian has run-mimecap installed.

rh



Re: xdg-open

2008-01-07 Thread RGH

Sven Hoexter wrote:

So the only to viable options I see are
a) remove the xdg-open calls
aa) and maybe replace them with a list of the distro specific tools like
mimeopen or run-mailcap (pretty long and ugly list ...)
b) try push some changes to xdg-open and hope for a fast adoption rate within 
the Linux distribution oekosystem.

  
Perhaps it's worth remembering that only fairly sophisticated users are 
going to encounter this problem. You have not to be using Gnome, KDE, or 
XFCE, or you have to be using LyX over ssh to run into the problem. And 
if you do, then the solution is as easy as picking a new viewer. So, 
while this is an inconvenience for some people, it's not that hugely 
awful. The point is that, if we thought (b) might give us some traction 
getting the larger problem sorted out, then maybe it's worth it.


Richard



Re: LFUN Docs and LFUN Order

2008-01-07 Thread rgheck

Abdelrazak Younes wrote:

Jürgen Spitzmüller wrote:

Abdelrazak Younes wrote:
For this use case a translation to the LFUN command string would be 
more

suited.


Probably. But I see no need to break what we have (the question was 
if the numbers should be deleted).


If we are to put some order in the LFUN, the numbers will all change 
every times you insert or delete an LFUN. This is cumbersome and 
probably the reason why new LFUNs were always put at the end of the enum.


Right. And surely a translation wouldn't be that hard to write. Of 
course, we'd have to find where the integers were being output.


Richard



Re: 1.6svn: File is modified externally when it isn't.

2008-01-07 Thread Bo Peng
 Such a warning is fine when the file _is_ externally modified, but
 that was not the case. LyX restored its own automatic backup,
 that is internal stuff. :-)

Is this from the latest svn? I recently changed this part for embedding support.

Bo


Re: 1.6svn: File is modified externally when it isn't.

2008-01-07 Thread Helge Hafting

Bo Peng wrote:

Such a warning is fine when the file _is_ externally modified, but
that was not the case. LyX restored its own automatic backup,
that is internal stuff. :-)



Is this from the latest svn? I recently changed this part for embedding support.
  

It is from a svn checkout last friday.

Helge Hafting


Re: [patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread rgheck

Jürgen Spitzmüller wrote:

Jürgen Spitzmüller wrote:
  

A Requires tag, as a counterpart of the Provides tag.



patch attached.

I guess this needs a layout format increment, right?

  

Yes, it would.

Something like this will work. Just a couple thoughts.

First, I don't think we want to tie this too tightly to LaTeXFeatures, 
so that we have to hardcode what packages can be Required. This will 
make maintenance difficult---you didn't list endnotes.sty---and anyway 
users ought to be able to Require packages in their custom layouts. So 
I'd suggest we have a more flexible mechanism for keeping track of what 
packages have been Required---just a vector we build---one that could be 
integrated at the last minute with LaTeXFeatures.


Secondly, it seems like we ought for the same reason to have a Requires 
tag in the TextClass itself.


Good work.

Richard



Re: [patch] add shortcut for numbered formulas

2008-01-07 Thread Jean-Marc Lasgouttes
Uwe Stöhr [EMAIL PROTECTED] writes:

 But when we have a default setting, we can also have a toggle button
 in the toolbar. It is more useful to be able to toggly numbering in
 the toolbar, because there are cases where e.g. in derivations 10
 consecutive formulas are numbered and the next 10 not.

I am not really for putting many pref settings in the menus (I know we
have DocumentCompressed). People who change often their mind about
what to number can number _after_ creating the formula IMO. If we have
3 different ways to number a formula in the menus, it is going to
become awful.

JMarc


Re: [patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread Jürgen Spitzmüller
rgheck wrote:
 Yes, it would.

OK. I'll do this before I commit anything.

 Something like this will work. Just a couple thoughts.

 First, I don't think we want to tie this too tightly to LaTeXFeatures,
 so that we have to hardcode what packages can be Required. This will
 make maintenance difficult---you didn't list endnotes.sty---and anyway

done now. The first patch was just a proof of concept.

 users ought to be able to Require packages in their custom layouts. So
 I'd suggest we have a more flexible mechanism for keeping track of what
 packages have been Required---just a vector we build---one that could be
 integrated at the last minute with LaTeXFeatures.

but then we lose all our possiblilities of package checking.

 Secondly, it seems like we ought for the same reason to have a Requires
 tag in the TextClass itself.

done. Patch attached. I think we can get rid of the ugly optional argument of 
DeclareLyXModule now.

Jürgen
Index: lib/layouts/endnotes.module
===
--- lib/layouts/endnotes.module	(Revision 22411)
+++ lib/layouts/endnotes.module	(Arbeitskopie)
@@ -1,4 +1,4 @@
-#\DeclareLyXModule[endnotes.sty]{Adds an endnote command, in addition to footnotes. You will need to add \theendnotes in ERT where you want the endnotes to appear.}{Endnote}
+#\DeclareLyXModule{Adds an endnote command, in addition to footnotes. You will need to add \theendnotes in ERT where you want the endnotes to appear.}{Endnote}
 
 Format 5
 
@@ -11,7 +11,5 @@
  Size	Small
EndFont
LabelString	endnote
-   Preamble
- \usepackage{endnotes}
-   EndPreamble
+   Requires	endnotes
 End
Index: lib/layouts/foottoend.module
===
--- lib/layouts/foottoend.module	(Revision 22411)
+++ lib/layouts/foottoend.module	(Arbeitskopie)
@@ -1,8 +1,9 @@
-#\DeclareLyXModule[endnotes.sty]{Sets all footnotes as endnotes. You will need to add \theendnotes in ERT where you want the endnotes to appear.}{Foot to End}
+#\DeclareLyXModule{Sets all footnotes as endnotes. You will need to add \theendnotes in ERT where you want the endnotes to appear.}{Foot to End}
 
 Format 5
 
+Requires	endnotes
+
 Preamble
-  \usepackage{endnotes}
   \let\footnote=\endnote
 EndPreamble
Index: lib/layouts/linguistics.module
===
--- lib/layouts/linguistics.module	(Revision 22411)
+++ lib/layouts/linguistics.module	(Arbeitskopie)
@@ -1,4 +1,4 @@
-#\DeclareLyXModule[covington.sty]{Defines some special environments useful for linguistics (numbered examples, glosses, semantic markup).}{Linguistics}
+#\DeclareLyXModule{Defines some special environments useful for linguistics (numbered examples, glosses, semantic markup).}{Linguistics}
 
 # Author: Jürgen Spitzmüller [EMAIL PROTECTED]
 
@@ -24,9 +24,7 @@
 		Shape Italic
 		Color Blue
 	EndFont
-	Preamble
-		\usepackage{covington}
-	EndPreamble
+	Requires	  covington
 End
 
 
@@ -49,9 +47,8 @@
 	LatexName subexample
 	LeftMarginXSubexample:
 	LabelString   Subexample:
+	Requires	  covington,enumitem
 	Preamble
-		\usepackage{covington}
-		\usepackage{enumitem}
 		\newenvironment{subexample}{%
 			\begin{example}\begin{enumerate}[leftmargin=1.7em]
 			\renewcommand\theenumi{\alph{enumi}}
@@ -76,8 +73,8 @@
 	MultiPar  true
 	PassThru  true
 	FreeSpacing   true
+	Requires	  covington
 	Preamble
-		\usepackage{covington}
 		[EMAIL PROTECTED]
 		\newenvironment{linggloss}[1]{%
 			\gll #1}
@@ -100,8 +97,8 @@
 	MultiPar  true
 	PassThru  true
 	FreeSpacing   true
+	Requires	  covington
 	Preamble
-		\usepackage{covington}
 		[EMAIL PROTECTED]
 		\newenvironment{lingglosss}[1]{%
 			\glll #1}
@@ -143,8 +140,8 @@
 	LabelString   meaning
 	LatexType command
 	LatexName lingmeaning
+	Requires	  csquotes
 	Preamble
-		\usepackage{csquotes}
 		\newcommand{\lingmeaning}[1]{\enquote*{#1}}
 	EndPreamble
 End
Index: lib/layouts/theorems-ams.module
===
--- lib/layouts/theorems-ams.module	(Revision 22411)
+++ lib/layouts/theorems-ams.module	(Arbeitskopie)
@@ -4,10 +4,12 @@
 # Adapted from amsdefs.inc and amsmaths.inc
 
 Format 5
+
+Requires	amsmath
+
 Preamble
-	\usepackage{amsmath}
   \theoremstyle{plain}
-	\newtheorem{thm}{Theorem}[section]
+  \newtheorem{thm}{Theorem}[section]
 EndPreamble
 
 
Index: lib/layouts/theorems-ams-withinsec.module
===
--- lib/layouts/theorems-ams-withinsec.module	(Revision 22411)
+++ lib/layouts/theorems-ams-withinsec.module	(Arbeitskopie)
@@ -4,10 +4,12 @@
 # Adapted from amsdefs.inc and amsmaths.inc
 
 Format 5
+
+Requires	amsmath
+
 Preamble
-	\usepackage{amsmath}
   \theoremstyle{plain}
-	

Re: 1.6svn: pasting lyxtext containing branches should create the branches that doesn't exist already

2008-01-07 Thread Martin Vermeer
On Mon, 07 Jan 2008 12:15:03 +0100
Helge Hafting [EMAIL PROTECTED] wrote:

 Open two documents, one with branches.
 Copy the contents with branches into the other document.
 Notice that the branch-boxes are created, but
 document-settings shows no branches at all.
 
 This at least causes the problem that one cannot turn branches
 on and off, and possibly other internal problems. (Can LyX
 save that document in a sane manner?)
 Creating the missing branches manually works, the
 pasted branches can then be turned on and off as usual.
 
 Helge Hafting

Yes, I ran into that one too... when pasting a Swedish language 'sv'
branch inset into a document expecting them to be named 'se' ;-)

Saving/loading works OK, but you won't be able to 'activate' a
non-defined branch inset, i.e., no LaTeX output.

What would a fix look like according to you (serious question)?

- Martin


Re: [patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread rgheck

Jürgen Spitzmüller wrote:

rgheck wrote:
  

Yes, it would.



OK. I'll do this before I commit anything.

  

Something like this will work. Just a couple thoughts.

First, I don't think we want to tie this too tightly to LaTeXFeatures,
so that we have to hardcode what packages can be Required. This will
make maintenance difficult---you didn't list endnotes.sty---and anyway users 
ought to be able to Require packages in their custom layouts. So
I'd suggest we have a more flexible mechanism for keeping track of what
packages have been Required---just a vector we build---one that could be 
integrated at the last minute with LaTeXFeatures.



but then we lose all our possiblilities of package checking.

  
I think this is a different issue. If someone wants to Require a package 
we don't have listed in LaTeXFeatures, then, yes, we can't check for it, 
and so we ought to ignore it for that purpose. But that's different from 
saying they can't Require such a package at all. Actually, I'm not sure 
how this will work in practice, anyway. What does happen if I try to 
Require foo? Surely there's some fairly simple way to handle this. 
(Unfortunately, I have to go deal with graduate admissions applications 
and can't play with LyX right now.)



Secondly, it seems like we ought for the same reason to have a Requires
 tag in the TextClass itself.
  


done. Patch attached. I think we can get rid of the ugly optional argument of 
DeclareLyXModule now.
  
OK, well, it's about to get new ones, anyway, so don't bother with 
configure.py. (It won't break right now, anyway.) I intend to implement 
Requires and Excludes arguments for the modules themselves as part of 
the modularization of the AMS classes. Thus, the Theorems module will 
exclude the Theorems (AMS) module, and it won't be possible to use 
them both. I also want to split the theorem modules themselves into 
basic and advanced parts, so that you don't have to overpopulate your 
layout box just to get the basic theorem constructs. Thus, Theorems 
(Extra) will require either Theorems or Theorems (AMS), since the 
basic definitions have to be in place already. I expect we'll find other 
uses for this, too.


Richard



Re: [patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread rgheck

Jürgen Spitzmüller wrote:

rgheck wrote:
  

I think this is a different issue. If someone wants to Require a package
we don't have listed in LaTeXFeatures, then, yes, we can't check for it,
and so we ought to ignore it for that purpose. But that's different from
saying they can't Require such a package at all. Actually, I'm not sure
how this will work in practice, anyway. What does happen if I try to
Require foo? Surely there's some fairly simple way to handle this.
(Unfortunately, I have to go deal with graduate admissions applications
and can't play with LyX right now.)



No, there's no simple way yet. For the moment, people can only require what is 
known to LyX (note that also the isAvailable() mechanism depends on this). If 
not, they will have to use the Preamble tag with all the disadvantages.
  


Right, of course. We should document, then, that Requires only works for 
packages known to LyX.
What we can do, eventually, is to simply add a \usepackage call with all 
remaining unknown required packages at the very end. For this, though, we need to know which packages we know. And this is not possible yet (since it's done in different methods).


  
OK. Maybe a FIXME or something about this, with a ref to this thread, 
would be worth it, if not a bugzilla entry.



For now, I'd just go with what I proposed.

  
OK. We're obviously not losing anything, and this is a big improvement 
on what we had.
I think we can get rid of the ugly optional argument of DeclareLyXModule now. 
  

OK, well, it's about to get new ones, anyway, so don't bother with
configure.py. (It won't break right now, anyway.) I intend to implement
Requires and Excludes arguments for the modules themselves as part of
the modularization of the AMS classes. Thus, the Theorems module will
exclude the Theorems (AMS) module, and it won't be possible to use
them both. I also want to split the theorem modules themselves into
basic and advanced parts, so that you don't have to overpopulate your
layout box just to get the basic theorem constructs. Thus, Theorems
(Extra) will require either Theorems or Theorems (AMS), since the
basic definitions have to be in place already. I expect we'll find other uses 
for this, too.



I'm not sure I understand. Anyway, I'll leave the optional argument in place 
for now.

  
The idea is that there can be incompatible modules: The Theorems and 
Theorems (AMS) modules are an example. And there may be modules that 
require other ones. So this will provide a facility for tracking that.


rh



Re: [patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread Jürgen Spitzmüller
rgheck wrote:
 I think this is a different issue. If someone wants to Require a package
 we don't have listed in LaTeXFeatures, then, yes, we can't check for it,
 and so we ought to ignore it for that purpose. But that's different from
 saying they can't Require such a package at all. Actually, I'm not sure
 how this will work in practice, anyway. What does happen if I try to
 Require foo? Surely there's some fairly simple way to handle this.
 (Unfortunately, I have to go deal with graduate admissions applications
 and can't play with LyX right now.)

No, there's no simple way yet. For the moment, people can only require what is 
known to LyX (note that also the isAvailable() mechanism depends on this).
If not, they will have to use the Preamble tag with all the disadvantages.

What we can do, eventually, is to simply add a \usepackage call with all 
remaining unknown required packages at the very end. For this, though, we 
need to know which packages we know. And this is not possible yet (since it's 
done in different methods).

What I would prefer to the above, though, is a proper package manager.

For now, I'd just go with what I proposed.

  Secondly, it seems like we ought for the same reason to have a Requires
 
   tag in the TextClass itself.
 
   
 
  done. Patch attached. I think we can get rid of the ugly optional
  argument of DeclareLyXModule now. 

 OK, well, it's about to get new ones, anyway, so don't bother with
 configure.py. (It won't break right now, anyway.) I intend to implement
 Requires and Excludes arguments for the modules themselves as part of
 the modularization of the AMS classes. Thus, the Theorems module will
 exclude the Theorems (AMS) module, and it won't be possible to use
 them both. I also want to split the theorem modules themselves into
 basic and advanced parts, so that you don't have to overpopulate your
 layout box just to get the basic theorem constructs. Thus, Theorems
 (Extra) will require either Theorems or Theorems (AMS), since the
 basic definitions have to be in place already. I expect we'll find other
 uses for this, too.

I'm not sure I understand. Anyway, I'll leave the optional argument in place 
for now.

Jürgen


Re: [patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread Jürgen Spitzmüller
rgheck wrote:
 Right, of course. We should document, then, that Requires only works for
 packages known to LyX.

I'll do that.

  What we can do, eventually, is to simply add a \usepackage call with all
  remaining unknown required packages at the very end. For this, though,
  we need to know which packages we know. And this is not possible yet
  (since it's done in different methods).
 
   

 OK. Maybe a FIXME or something about this, with a ref to this thread,
 would be worth it, if not a bugzilla entry.

OK.

  For now, I'd just go with what I proposed.
 
   

 OK. We're obviously not losing anything, and this is a big improvement
 on what we had.

Fine. I'll commit then.

  I think we can get rid of the ugly optional argument of
  DeclareLyXModule now. 
 
  OK, well, it's about to get new ones, anyway, so don't bother with
  configure.py. (It won't break right now, anyway.) I intend to implement
  Requires and Excludes arguments for the modules themselves as part of
  the modularization of the AMS classes. Thus, the Theorems module will
  exclude the Theorems (AMS) module, and it won't be possible to use
  them both. I also want to split the theorem modules themselves into
  basic and advanced parts, so that you don't have to overpopulate your
  layout box just to get the basic theorem constructs. Thus, Theorems
  (Extra) will require either Theorems or Theorems (AMS), since the
  basic definitions have to be in place already. I expect we'll find other
  uses for this, too. 
 
  I'm not sure I understand. Anyway, I'll leave the optional argument in
  place for now.
 
   

 The idea is that there can be incompatible modules: The Theorems and
 Theorems (AMS) modules are an example. And there may be modules that
 require other ones. So this will provide a facility for tracking that.

I understand. But I don't understand the relation to the optional argument. 
I'd say, we need some more tags, such as NeedsModule and ObsoletesModule.
Anyway, this is for later.

Jürgen


Re: Quote mark added when switching windows

2008-01-07 Thread Konrad Hofbauer

Dear all,

That the quote-mark gets sent through when switching windows is quite a 
big issue for me. I use this key-combination all the time in all 
applications, and because of this I had more than once an (undiscovered) 
quote-sign in a printed publication.


If one has something marked in LyX when switching windows in the 
standard mac-way, this behavior even leads to quiet DATA LOSS !!!


I tried to re-define (or better: disable) in LyX the leftquote key using 
a new bindfile with e.g.

\bind_file mac.bind
\bind quoteleft screen-recenter
which works when pressing the quoteleft key, only. If I press however 
Command-quoteleft (switching the windows of the foremost application), 
still the quoteleft-character appears in LyX (ignoring what is in my 
bindfile).


Any other possibility for a (temporary) workaround until it gets fixed 
in Qt???


Thanks a lot and best regards,
Konrad



Re: [Cvslog] r22365 - /lyx-devel/trunk/src/frontends/qt4/Menus.cpp

2008-01-07 Thread Jean-Marc Lasgouttes
Jürgen Spitzmüller [EMAIL PROTECTED] writes:

 Jean-Marc Lasgouttes wrote:
 Here it is. OK?

 OK.

Done.

JMarc


Re: [Cvslog] r22350 - in /lyx-devel/trunk/src/mathed: InsetMathHull.cp...

2008-01-07 Thread Jean-Marc Lasgouttes
Jürgen Spitzmüller [EMAIL PROTECTED] writes:

 Jean-Marc Lasgouttes wrote:
 Would this patch be OK?

 Looks sensible.

Applied (no status.15x entry necessary).

JMarc


[patch] Re: xdg-open

2008-01-07 Thread Pavel Sanda
  not regress for everyone.  imo.
  
  well now the status is we have regression of 1.5.3 to 1.5.2 for some
  users.
 
 some = (small) minority, as well as creating a much better user-experience
 for the rest.

continuing this way we can one day conclude that we should stop support linux
platform as 99% people use much better user-experience win.

the following patch is ugly but i dont see many other ways compared to reverting
the xdg stuff. i'm no pythonist so somebody should look it over.

Juergen you are the 1.5 chief, what you think ?

pavel
Index: configure.py
===
--- configure.py(revision 22413)
+++ configure.py(working copy)
@@ -8,7 +8,7 @@
 # \author Bo Peng
 # Full author contact details are available in file CREDITS.
 
-import sys, os, re, shutil, glob
+import sys, os, re, shutil, glob, commands
 
 
 class Tee:
@@ -178,9 +178,28 @@
 addToRC(rc_entry[-1].replace('%%', not_found))
 return ['', not_found]
 
+def detectDE():
+''' 
+   Check for desktop environment. Needed for xdg-open which
+   has awful behaviour in case no DE is detected.
+'''
+DE = 0
+if os.environ.get(KDE_FULL_SESSION):
+DE = 1
+else:
+   if os.environ.get(GNOME_DESKTOP_SESSION_ID):
+   DE = 1
+   else:
+   if commands.getoutput(pidof xfce-mcs-manage) != :
+   DE = 1
+return DE
 
 def checkViewer(description, progs, rc_entry = [], path = []):
 ''' The same as checkProg, but for viewers and editors '''
+if not detectDE():
+if (xdg-open in progs):
+progs.remove(xdg-open)
+
 return checkProg(description, progs, rc_entry, path, not_found = 'auto')
 
 


Re: [patch] Re: bug in linguistics module or modules in general

2008-01-07 Thread Richard Heck



The idea is that there can be incompatible modules: The Theorems and
Theorems (AMS) modules are an example. And there may be modules that
require other ones. So this will provide a facility for tracking that.



I understand. But I don't understand the relation to the optional argument. 
I'd say, we need some more tags, such as NeedsModule and ObsoletesModule.

Anyway, this is for later.

  
I'll do this shortly, as I want to get the AMS classes modularized so we 
have plenty of time to test them. And that will also give the module 
backend a good workout, too. In any event, the reason it has to be in 
the \DeclareLyXModule line is that I want to have this information 
available in lyxmodules.lst, which is constructed by configure.py, so 
that it will then be available in the global moduleList variable, which 
is for Module what textclasslist is for TextClass. That way, GuiDocument 
can have access to the information that, say, Theorem (AMS) excludes 
Theorem and not allow you to add the former if you've already added the 
latter. Etc.


rh



Re: Quote mark added when switching windows

2008-01-07 Thread Bennett Helm

On Jan 7, 2008, at 12:11 PM, Konrad Hofbauer wrote:


Dear all,

That the quote-mark gets sent through when switching windows is  
quite a big issue for me. I use this key-combination all the time  
in all applications, and because of this I had more than once an  
(undiscovered) quote-sign in a printed publication.


If one has something marked in LyX when switching windows in the  
standard mac-way, this behavior even leads to quiet DATA LOSS !!!


I tried to re-define (or better: disable) in LyX the leftquote key  
using a new bindfile with e.g.

\bind_file mac.bind
\bind quoteleft screen-recenter
which works when pressing the quoteleft key, only. If I press  
however Command-quoteleft (switching the windows of the foremost  
application), still the quoteleft-character appears in LyX  
(ignoring what is in my bindfile).


Any other possibility for a (temporary) workaround until it gets  
fixed in Qt???


Two possibilities, but you're not going to like them:

1. Use the mouse to switch windows.

2. Use only a single window (with opttab and optshifttab to  
switch between tabs).


I don't know of any keyboard-based solutions.

Bennett


Re: Quote mark added when switching windows

2008-01-07 Thread Konrad Hofbauer

Bennett Helm wrote:
Any other possibility for a (temporary) workaround until it gets fixed 
in Qt???


Two possibilities, but you're not going to like them:

1. Use the mouse to switch windows.

2. Use only a single window (with opttab and optshifttab to 
switch between tabs).


I don't know of any keyboard-based solutions.


Thanks Bennett.

My problem is actually not so much that I would NEED keyboard-based 
window switching in LyX - I can live well without it.


The problem is that nevertheless sometimes I DO use the standard 
key-combination (e.g. to jump to/from a dialog box that I left open) and 
then harm is caused (without me noticing it).


So let me reword the question:
Can I somehow (completely) disable the leftquote key in LyX, as a 
workaround to this bug?


/Konrad


Re: LFUN Docs and LFUN Order

2008-01-07 Thread Andre Poenitz
On Mon, Jan 07, 2008 at 09:31:58AM +0100, Abdelrazak Younes wrote:
 Jürgen Spitzmüller wrote:
 Pavel Sanda wrote:
 i also wonder whats the meaning of number-counting of the lfuns.
 does anybody use it or can it be deleted too ?
 I use it. It's very helpful for debugging.

 Are you sure GDB won't directly gives the enum value? I think it did last 
 time I used that many years ago... Do you use it at the shell or within 
 some visual frontend?

GDB does give the enum values 'symbolically'. But people also use
'debugging by printf' as debug-enabled build takes ages to link...

Andre'


Showing a pin to the top-left corner of embedded figures.

2008-01-07 Thread Bo Peng
Dear all,

The attached patch adds a 'pin' icon to the left top corner of
embedded figures (see attached test-pin.png). Because I am not
familiar with lyx graphics, I need an OK to proceed.

To test, please apply pin.diff, and add pin.png to lib/images. Note
that the icon is not updated correctly right now with the changing of
embedding status.

Cheers,
Bo
attachment: test-pin.pngattachment: pin.pngIndex: development/scons/scons_manifest.py
===
--- development/scons/scons_manifest.py	(revision 22418)
+++ development/scons/scons_manifest.py	(working copy)
@@ -1428,6 +1428,7 @@
 note-next.png
 paste.png
 promote.png
+pin.png
 psnfss1.png
 psnfss2.png
 psnfss3.png
Index: src/insets/InsetGraphicsParams.cpp
===
--- src/insets/InsetGraphicsParams.cpp	(revision 22418)
+++ src/insets/InsetGraphicsParams.cpp	(working copy)
@@ -274,6 +274,7 @@
 {
 	graphics::Params pars;
 	pars.filename = filename.availableFile();
+	pars.icon = filename.embedded() ? pin.png : ;
 	pars.scale = lyxscale;
 	pars.angle = convertdouble(rotateAngle);
 
Index: src/insets/RenderGraphic.h
===
--- src/insets/RenderGraphic.h	(revision 22418)
+++ src/insets/RenderGraphic.h	(working copy)
@@ -45,6 +45,7 @@
 
 	/// The stored data.
 	graphics::Loader loader_;
+	graphics::Loader icon_;
 	graphics::Params params_;
 };
 
Index: src/insets/RenderGraphic.cpp
===
--- src/insets/RenderGraphic.cpp	(revision 22418)
+++ src/insets/RenderGraphic.cpp	(working copy)
@@ -14,6 +14,8 @@
 
 #include insets/Inset.h
 
+#include support/FileName.h
+#include support/filetools.h
 #include support/gettext.h
 #include LyX.h
 #include LyXRC.h
@@ -36,13 +38,16 @@
 RenderGraphic::RenderGraphic(Inset const * inset)
 {
 	loader_.connect(boost::bind(Inset::updateFrontend, inset));
+	icon_.connect(boost::bind(Inset::updateFrontend, inset));
 }
 
 
 RenderGraphic::RenderGraphic(RenderGraphic const  other, Inset const * inset)
-	: RenderBase(other), loader_(other.loader_), params_(other.params_)
+	: RenderBase(other), loader_(other.loader_), icon_(other.icon_),
+		params_(other.params_)
 {
 	loader_.connect(boost::bind(Inset::updateFrontend, inset));
+	icon_.connect(boost::bind(Inset::updateFrontend, inset));
 }
 
 
@@ -58,6 +63,12 @@
 
 	if (!params_.filename.empty())
 		loader_.reset(params_.filename, params_);
+	if (!params_.icon.empty()) {
+		support::FileName const icon = support::libFileSearch(images/,
+			params_.icon, png);
+		if (!icon.empty()) // using an empty bounding box
+			icon_.reset(icon, graphics::Params());
+	}
 }
 
 
@@ -172,6 +183,10 @@
 			loader_.startLoading();
 		if (!loader_.monitoring())
 			loader_.startMonitoring();
+		if (icon_.status() == graphics::WaitingToLoad)
+			icon_.startLoading();
+		if (!icon_.monitoring())
+			icon_.startMonitoring();
 	}
 
 	// This will draw the graphics. If the graphics has not been
@@ -211,6 +226,9 @@
  y - 4, msg, msgFont);
 		}
 	}
+	if (!params_.icon.empty()  readyToDisplay(icon_))
+		pi.pain.image(x + Inset::TEXT_TO_INSET_OFFSET, y - dim_.asc, 
+			10, 10, *icon_.image());
 }
 
 
Index: src/graphics/GraphicsParams.h
===
--- src/graphics/GraphicsParams.h	(revision 22418)
+++ src/graphics/GraphicsParams.h	(working copy)
@@ -72,6 +72,12 @@
 	 */
 	/// Rotation angle.
 	double angle;
+
+	/** The icon to be displayed to the top-left corner of an image.
+	 *  It is mutable because an icon reflect a temporary status of
+	 *  the image, and is variable.
+	 */
+	mutable std::string icon;
 };
 
 bool operator==(Params const , Params const );
Index: lib/images/pin.png
===
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/images/pin.png
___
Name: svn:mime-type
   + application/octet-stream



Re: Quote mark added when switching windows

2008-01-07 Thread Bennett Helm

On Jan 7, 2008, at 1:33 PM, Konrad Hofbauer wrote:


Bennett Helm wrote:
Any other possibility for a (temporary) workaround until it gets  
fixed in Qt???

Two possibilities, but you're not going to like them:
1. Use the mouse to switch windows.
2. Use only a single window (with opttab and optshifttab  
to switch between tabs).

I don't know of any keyboard-based solutions.


Thanks Bennett.

My problem is actually not so much that I would NEED keyboard-based  
window switching in LyX - I can live well without it.


The problem is that nevertheless sometimes I DO use the standard  
key-combination (e.g. to jump to/from a dialog box that I left  
open) and then harm is caused (without me noticing it).


So let me reword the question:
Can I somehow (completely) disable the leftquote key in LyX, as a  
workaround to this bug?


Not without disabling it for all applications on your Mac. (To do  
that, use the Keyboard Shortcuts tab of the Keyboard and Mouse system  
preference.) It looks like the best solution for you #2, which is  
what I do: since there is only one window, I'm not even tempted to  
use Cmd' ... but if I did, then it would appear in the active  
window for me to notice and correct. When I absolutely need to see  
what's in another LyX document at the same time I work on one, I  
create a .pdf and display that on screen next to the LyX window.


Bennett


Re: Showing a pin to the top-left corner of embedded figures.

2008-01-07 Thread Bo Peng
The attached new pin.png has transparent background.

Bo
attachment: pin.pngattachment: test-pin.png

Re: [Cvslog] r22421 - /lyx-devel/trunk/lib/layouts/amsart-plain.layout

2008-01-07 Thread Richard Heck

[EMAIL PROTECTED] wrote:

Author: spitz
Date: Mon Jan  7 19:31:05 2008
New Revision: 22421

URL: http://www.lyx.org/trac/changeset/22421
Log:
Requires amsmath does not work. No idea why.

  

I'm guessing it's because amsdefs.inc Provides amsmath, and then you have:
bool LaTeXFeatures::mustProvide(string const  name) const
{
return isRequired(name)  !params_.getTextClass().provides(name);
}
So the require is ignored.

Another possibility is that the order could get messed up in such cases.

For what it's worth, I don't understand this Preamble bit. So far as I 
can see, there isn't any other Preamble bit we're overriding here, and 
that's what the comment makes it sound like.


rh


Modified:
lyx-devel/trunk/lib/layouts/amsart-plain.layout

Modified: lyx-devel/trunk/lib/layouts/amsart-plain.layout
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/lib/layouts/amsart-plain.layout?rev=22421
==
--- lyx-devel/trunk/lib/layouts/amsart-plain.layout (original)
+++ lyx-devel/trunk/lib/layouts/amsart-plain.layout Mon Jan  7 19:31:05 2008
@@ -17,10 +17,8 @@
 
 # Use a simpler preamble.

 Preamble
-   \usepackage{amsthm}
+   \usepackage{amsmath,amsthm}
\usepackage{amsfonts}
 EndPreamble
 
-Requires	amsmath

-
 Input amsmaths-plain.inc


___
Cvslog mailing list
[EMAIL PROTECTED]
http://www.lyx.org/mailman/listinfo/cvslog
  




[PATCH] Extra Requires Hack

2008-01-07 Thread Richard Heck


This is a hack, and I haven't tested it, or even compiled it, since I 
can't compile here at the moment. Just an idea in lieu of more 
sophisticated packaging stuff.


rh


Index: LaTeXFeatures.cpp
===
--- LaTeXFeatures.cpp	(revision 22419)
+++ LaTeXFeatures.cpp	(working copy)
@@ -494,6 +494,8 @@
 
 namespace {
 
+//  These are all the 'simple' includes.  i.e
+//  packages which we just \usepackage{package}
 char const * simplefeatures[] = {
 // note that the package order here will be the same in the LaTeX-output
 	array,
@@ -539,28 +541,46 @@
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
 
+//other features handled in getPackages() that require more complicated
+//output
+char const * complexfeatures[] = {
+	amsmath,
+	wasysym,
+	color,
+	makeidx,
+	graphicx,
+	lyxskak,
+	setspace,
+	amssymb,
+	esint,
+	natbib,
+	jurabib,
+	bibtopic,
+	xy,
+	nomencl
 }
 
+int const nb_complexfeatures = sizeof(complexfeatures) / sizeof(char const *);
 
+void eraseFeature(FeaturesList  f, string n)
+{
+	f.erase(f.find(n));
+}
+
+} // end anonymous namespace
+
+
 string const LaTeXFeatures::getPackages() const
 {
 	ostringstream packages;
 	TextClass const  tclass = params_.getTextClass();
+	FeatureList unknownFeatures = features_;
 
-	// FIXME: currently, we can only load packages and macros known
-	// to LyX.
-	// However, with the Require tag of layouts/custom insets,
-	// also inknown packages can be requested. They are silently
-	// swallowed now. We should change this eventually.
-
-	//
-	//  These are all the 'simple' includes.  i.e
-	//  packages which we just \usepackage{package}
-	//
 	for (int i = 0; i  nb_simplefeatures; ++i) {
-		if (mustProvide(simplefeatures[i]))
-			packages  \\usepackage{
-  simplefeatures[i]  }\n;
+		string const  pkg = simplefeatures[i];
+		if (mustProvide(pkg))
+			packages  \\usepackage{  pkg  }\n;
+		eraseFeature(unknownFeatures, pkg); //LyX has handled this one
 	}
 
 	//
@@ -707,6 +727,17 @@
 
 	if (mustProvide(listings))
 		packages  \\usepackage{listings}\n;
+	
+	//delete all the complex features from the list
+	for (int i = 0; i  nb_complexfeatures; ++i) {
+		string const  pkg = complexfeatures[i];
+		eraseFeatures(unknownFeatures, pkg); //LyX handled it
+	}
+	//usepackage all the remaining requires
+	FeatureList::const_iterator it = unknownFeatures.begin();
+	FeatureList::const_iterator end = unknownFeatures.end();
+	for (; it != end; ++it) 
+		packages  \\usepackage{ + *it + }\n;
 
 	return packages.str();
 }


Re: [Cvslog] r22421 - /lyx-devel/trunk/lib/layouts/amsart-plain.layout

2008-01-07 Thread Jürgen Spitzmüller
Richard Heck wrote:
 I'm guessing it's because amsdefs.inc Provides amsmath, and then you have:
 bool LaTeXFeatures::mustProvide(string const  name) const
 {
 return isRequired(name)  !params_.getTextClass().provides(name);
 }
 So the require is ignored.

Yes, this makes sense. And then, it would even be correct to _not_ load 
amsmath explicitely.

 Another possibility is that the order could get messed up in such cases.

 For what it's worth, I don't understand this Preamble bit. So far as I
 can see, there isn't any other Preamble bit we're overriding here, and
 that's what the comment makes it sound like.

Me neither. I don't have time to test it, and the ams classes are fragile due 
to the several includes and subincludes. So I leave it for now.

Jürgen


Re: [patch] Re: xdg-open

2008-01-07 Thread Jürgen Spitzmüller
Pavel Sanda wrote:
 Juergen you are the 1.5 chief, what you think ?

Actually, I'm not sure how to proceed here. What do others think?

Jürgen


Re: LFUN Docs and LFUN Order

2008-01-07 Thread Richard Heck

Andre Poenitz wrote:

On Mon, Jan 07, 2008 at 09:31:58AM +0100, Abdelrazak Younes wrote:
  

Jürgen Spitzmüller wrote:


Pavel Sanda wrote:
  

i also wonder whats the meaning of number-counting of the lfuns.
does anybody use it or can it be deleted too ?


I use it. It's very helpful for debugging.
  
Are you sure GDB won't directly gives the enum value? I think it did last 
time I used that many years ago... Do you use it at the shell or within 
some visual frontend?



GDB does give the enum values 'symbolically'. But people also use
'debugging by printf' as debug-enabled build takes ages to link...

  
Then maybe some override of lyxerr  is the right way to go. That's 
better than printf, anyway.


The code numbers in lfuns.h will be a pain if we're trying to keep the 
list organized.


rh



Re: [patch] Re: xdg-open

2008-01-07 Thread Richard Heck

Jürgen Spitzmüller wrote:

Pavel Sanda wrote:
  

Juergen you are the 1.5 chief, what you think ?



Actually, I'm not sure how to proceed here. What do others think?

  
If it's causing problems, let's just roll it back until we have 
something that actually works. We've had a good discussion, and we know 
what the issues are, and they're really upstream from us. Rex and Sven 
have both talked about working on this


rh



Re: [PATCH] Extra Requires Hack

2008-01-07 Thread Jürgen Spitzmüller
Richard Heck wrote:
 This is a hack, and I haven't tested it, or even compiled it, since I
 can't compile here at the moment. Just an idea in lieu of more
 sophisticated packaging stuff.

Note that we are also requiering macros, such as LyX, noun 
or ct-xcolor-soul. All these would need to be considered as well.

Jürgen


Re: [PATCH] Extra Requires Hack

2008-01-07 Thread Richard Heck

Jürgen Spitzmüller wrote:

Richard Heck wrote:
  

This is a hack, and I haven't tested it, or even compiled it, since I
can't compile here at the moment. Just an idea in lieu of more
sophisticated packaging stuff.



Note that we are also requiering macros, such as LyX, noun 
or ct-xcolor-soul. All these would need to be considered as well.


  

Ick. OK, then, we can do that.

rh

Index: LaTeXFeatures.cpp
===
--- LaTeXFeatures.cpp	(revision 22419)
+++ LaTeXFeatures.cpp	(working copy)
@@ -494,6 +494,8 @@
 
 namespace {
 
+//  These are all the 'simple' includes.  i.e
+//  packages which we just \usepackage{package}
 char const * simplefeatures[] = {
 // note that the package order here will be the same in the LaTeX-output
 	array,
@@ -539,28 +541,79 @@
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
 
+//other features handled in getPackages() that require more complicated
+//output
+char const * complexfeatures[] = {
+	amsmath,
+	wasysym,
+	color,
+	makeidx,
+	graphicx,
+	lyxskak,
+	setspace,
+	amssymb,
+	esint,
+	natbib,
+	jurabib,
+	bibtopic,
+	xy,
+	nomencl
 }
 
 
+int const nb_complexfeatures = sizeof(complexfeatures) / sizeof(char const *);
+
+
+//macros recognized by getMacros()
+char const * macrofeatures[] = {
+	LyX, 
+	lyxline,
+	noun,
+	lyxarrow,
+	textgreek,
+	textcyr,
+	quotesinglbase,
+	quotedblbase,
+	guilsinglleft,
+	guilsinglright,
+	guillemotleft,
+	guillemotright,
+	boldsymbol,
+	binom,
+	mathcircumflex,
+	newlyxcommand,
+	ParagraphLeftIndent,
+	NeedLyXFootnoteCode,
+	NeedTabularnewline,
+	lyxgreyedout,
+	lyxdot,
+	ct-dvipost,
+	ct-xcolor-soul,
+	ct-none
+}
+
+
+int const nb_macrofeatures = sizeof(macrofeatures) / sizeof(char const *);
+
+void eraseFeature(FeaturesList  f, string n)
+{
+	f.erase(f.find(n));
+}
+
+} // end anonymous namespace
+
+
 string const LaTeXFeatures::getPackages() const
 {
 	ostringstream packages;
 	TextClass const  tclass = params_.getTextClass();
+	FeatureList unknownFeatures = features_;
 
-	// FIXME: currently, we can only load packages and macros known
-	// to LyX.
-	// However, with the Require tag of layouts/custom insets,
-	// also inknown packages can be requested. They are silently
-	// swallowed now. We should change this eventually.
-
-	//
-	//  These are all the 'simple' includes.  i.e
-	//  packages which we just \usepackage{package}
-	//
 	for (int i = 0; i  nb_simplefeatures; ++i) {
-		if (mustProvide(simplefeatures[i]))
-			packages  \\usepackage{
-  simplefeatures[i]  }\n;
+		string const  pkg = simplefeatures[i];
+		if (mustProvide(pkg))
+			packages  \\usepackage{  pkg  }\n;
+		eraseFeature(unknownFeatures, pkg); //LyX has handled this one
 	}
 
 	//
@@ -707,7 +760,24 @@
 
 	if (mustProvide(listings))
 		packages  \\usepackage{listings}\n;
+	
+	//delete all the complex features from the list...
+	for (int i = 0; i  nb_complexfeatures; ++i) {
+		string const  pkg = complexfeatures[i];
+		eraseFeatures(unknownFeatures, pkg); //LyX handled it
+	}
+	//...and the macros
+	for (int i = 0; i  nb_macrofeatures; ++i) {
+		string const  pkg = macrofeatures[i];
+		eraseFeatures(unknownFeatures, pkg); //LyX handled it
+	}
 
+	//usepackage all the remaining requires
+	FeatureList::const_iterator it = unknownFeatures.begin();
+	FeatureList::const_iterator end = unknownFeatures.end();
+	for (; it != end; ++it) 
+		packages  \\usepackage{ + *it + }\n;
+
 	return packages.str();
 }
 


Re: character counter

2008-01-07 Thread Richard Heck

McFisto McFist wrote:

Hello, hopefully this is the right place for this.

Is there any chance a character counter could be implemented into Lyx? It
would be of great help when writing university papers

  

There is a word counter. Your teachers count characters?

rh



Re: [Cvslog] r22422 - /lyx-devel/trunk/src/lfuns.h

2008-01-07 Thread Andre Poenitz
On Mon, Jan 07, 2008 at 06:54:25PM -, [EMAIL PROTECTED] wrote:
 Author: sanda
 Date: Mon Jan  7 19:54:23 2008
 New Revision: 22422
 
 URL: http://www.lyx.org/trac/changeset/22422
 Log:
 Add lfuns doxy.
 
 Modified:
 lyx-devel/trunk/src/lfuns.h
 
 Modified: lyx-devel/trunk/src/lfuns.h
 URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/lfuns.h?rev=22422
 ==
 --- lyx-devel/trunk/src/lfuns.h (original)
 +++ lyx-devel/trunk/src/lfuns.h Mon Jan  7 19:54:23 2008
 @@ -370,7 +370,13 @@
   LFUN_DELETE_FORWARD_SKIP,
   LFUN_BUFFER_NEW_TEMPLATE,   // Asger 1997-02-02
   LFUN_BUFFER_RELOAD, // Asger 1997-02-02
 - LFUN_RECONFIGURE,   // Asger 1997-02-14
 +/**
 + * LFUN_RECONFIGURE
 + * \li Action: Reconfigure the automatic settings.
 + * \li Syntax: reconfigure
 + * \li Origin: Asger , 14 Feb 1997
 + */
 + LFUN_RECONFIGURE,

Can't we just put the comments in the C++ file?

This would even let us the keep the 'historical' lfun order.

Andre'


Re: [Cvslog] r22422 - /lyx-devel/trunk/src/lfuns.h

2008-01-07 Thread Pavel Sanda
 Can't we just put the comments in the C++ file?

if you show me how :)
in other words i was not successful to generate doxygen output
when putting the doxy entries in LyXAction.cpp. but i put just
minimal effort to explore that possibility.

 This would even let us the keep the 'historical' lfun order.

i dont insist on reordering.

pavel


Re: character counter

2008-01-07 Thread Pavel Sanda
 Is there any chance a character counter could be implemented into Lyx? It
 would be of great help when writing university papers

such counter is quite simple. do we want it ?
pavel
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 19e16da..bfd87fb 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1143,15 +1143,15 @@ bool BufferView::dispatch(FuncRequest const  cmd)
from = doc_iterator_begin(buffer_.inset());
to = doc_iterator_end(buffer_.inset());
}
-   int const count = countWords(from, to);
+   pairint, int const count = countWords(from, to);
docstring message;
-   if (count != 1) {
+   if (count.first != 1) {
if (cur.selection())
-   message = bformat(_(%1$d words in selection.),
- count);
+   message = bformat(_(%1$d words, %2$d 
characters in selection.),
+ count.first, count.second);
else
-   message = bformat(_(%1$d words in 
document.),
- count);
+   message = bformat(_(%1$d words, %2$d 
characters in document.),
+ count.first, 
count.second);
}
else {
if (cur.selection())
diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp
index d38e3aa..26c5e87 100644
--- a/src/buffer_funcs.cpp
+++ b/src/buffer_funcs.cpp
@@ -160,9 +160,10 @@ Buffer * newUnnamedFile(string const  templatename, 
FileName const  path)
 }
 
 
-int countWords(DocIterator const  from, DocIterator const  to)
+std::pairint, int countWords(DocIterator const  from, DocIterator const  
to)
 {
int count = 0;
+   int chars = 0;
bool inword = false;
for (DocIterator dit = from ; dit != to ; dit.forwardPos()) {
// Copied and adapted from isLetter() in ControlSpellChecker
@@ -170,6 +171,7 @@ int countWords(DocIterator const  from, DocIterator const 
 to)
 dit.pos() != dit.lastpos()
 dit.paragraph().isLetter(dit.pos())
 !dit.paragraph().isDeleted(dit.pos())) {
+   ++chars;
if (!inword) {
++count;
inword = true;
@@ -178,7 +180,7 @@ int countWords(DocIterator const  from, DocIterator const 
 to)
inword = false;
}
 
-   return count;
+   return make_pair(count, chars);
 }
 
 
diff --git a/src/buffer_funcs.h b/src/buffer_funcs.h
index 061dc80..858d80d 100644
--- a/src/buffer_funcs.h
+++ b/src/buffer_funcs.h
@@ -42,7 +42,7 @@ Buffer * newUnnamedFile(std::string const  templatename,
support::FileName const  path);
 
 /// Count the number of words in the text between these two iterators
-int countWords(DocIterator const  from, DocIterator const  to);
+std::pairint, int countWords(DocIterator const  from, DocIterator const  
to);
 
 /// updates all counters
 void updateLabels(Buffer const , bool childonly = false);


Re: LFUN Docs and LFUN Order

2008-01-07 Thread christian . ridderstrom

On Mon, 7 Jan 2008, Richard Heck wrote:

The code numbers in lfuns.h will be a pain if we're trying to keep the 
list organized.


What was the reason for re-arranging the LFUNs? Better/nicer 
documentation?


If so, couldn't that be done in some other way?  What if we just add for 
instance a documentation section describing 'word-right', 'word-left', 
'word-...' and then for the definition of 'word-right' etc , we refer to 
that section.


/Christian

--
Christian Ridderström, +46-8-768 39 44   http://www.md.kth.se/~chr

Re: character counter

2008-01-07 Thread Abdelrazak Younes

Pavel Sanda wrote:

Is there any chance a character counter could be implemented into Lyx? It
would be of great help when writing university papers


such counter is quite simple. do we want it ?


Why not? You'll have to modify the relevant dialog accordingly.

Abdel.



Re: [Cvslog] r22417 - /lyx-devel/branches/BRANCH_1_5_X/lib/ui/stdmenus...

2008-01-07 Thread Martin Vermeer
On Mon, Jan 07, 2008 at 05:22:12PM +, [EMAIL PROTECTED] wrote:
 Author: lasgouttes
 Date: Mon Jan  7 18:22:11 2008
 New Revision: 22417
 
 URL: http://www.lyx.org/trac/changeset/22417
 Log:
 rename menu entries for numbering formulas

...

   Menu edit_math
 - Item Toggle Numbering|N math-number
 - Item Toggle Numbering of Line|u math-nonumber
 + Item Number whole Formula|N math-number
 + Item Number this Line|u math-nonumber
   Submenu Change Limits Type|L edit_math_limits
   Separator
   Submenu Change Formula Type|F edit_math_mutate


This is not renaming, it's re-titling :-)

- Martin
 


Re: LFUN Docs and LFUN Order

2008-01-07 Thread rgheck

[EMAIL PROTECTED] wrote:

On Mon, 7 Jan 2008, Richard Heck wrote:

The code numbers in lfuns.h will be a pain if we're trying to keep 
the list organized.


What was the reason for re-arranging the LFUNs? Better/nicer 
documentation?


If so, couldn't that be done in some other way?  What if we just add 
for instance a documentation section describing 'word-right', 
'word-left', 'word-...' and then for the definition of 'word-right' 
etc , we refer to that section.


Yes, that was the idea: that when we auto-generate the doxygen stuff, 
we'll get a nicely organized output.


I'm no expert with doxygen, so I'll let you and Pavel figure out if this 
is workable.


rh



changeset/22414

2008-01-07 Thread Uwe Stöhr
The layout file format has been increased by this. Do we need to add a conversion routine to 
layout2layout?


regards Uwe


Re: character counter

2008-01-07 Thread rgheck

McFisto McFist wrote:



On Jan 7, 2008 8:50 PM, Richard Heck [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


McFisto McFist wrote:
 Hello, hopefully this is the right place for this.

 Is there any chance a character counter could be implemented
into Lyx? It
 would be of great help when writing university papers


There is a word counter. Your teachers count characters?



yes, for some reason we are expected to hand over the exact number of 
characters.


That is the strangest thing I've heard from the teaching world in a long 
time. (I teach at University myself.)


Anyway, this isn't hard to do:

#!/bin/sh
FILE=$1;
if [ -z $FILE ]; then
   echo Usage: countlyxchars FILE;
   exit 1;
fi
lyx -export text $FILE;
cat ${FILE%.lyx}.txt | sed -e 's/\s//g' | wc -c


That'll get you pretty close.

Richard



changeset/22418

2008-01-07 Thread Uwe Stöhr
Why have you changes the menu entry? Alt-m n that is bound to this menu really toggles the 
numbering: When the formula is numbered, it will we unnumbered. So now the menu entry is not correct.


That this menu toggles the numbering is btw. correct and shouldn't be changed.

regards Uwe


Re: character counter

2008-01-07 Thread Uwe Stöhr

 Is there any chance a character counter could be implemented into Lyx? It
 would be of great help when writing university papers

 such counter is quite simple. do we want it ?

Absolutely! It was reported that this is a killer feature in some fields: In Germany expertises are 
sold by the amount of characters, see

http://bugzilla.lyx.org/show_bug.cgi?id=2819#c4

regards Uwe


Any lessons to be learned from WriteRoom?

2008-01-07 Thread christian . ridderstrom

The article in NY Times spawned a discussion on ./, see this link
http://slashdot.org/article.pl?sid=08/01/06/1731247from=rss

One interesting post of possible interest to use was the following about 
'WriteRoom':


I'm Jesse Grosjean, the guy who wrote WriteRoom
http://hogbaysoftware.com/products/writeroom

You are not the first to say that WriteRoom == Bad copy of VIM,
snip

.. but I also think that you are not really understanding
WriteRoom's purpose.

snip

Instead, it's just meant to provide distraction free writing.

snip

* No distractions. Full screen. Hidden menu bar. Hidden scroll
  bar. Nothing but text.
* In full screen mode text doesn't wrap over the entire screen.
  Instead your text is formated in a readable column in the center
  of the screen.
* Few important writers statistics (word count) pop up at bottom
  of screen, but hidden by default.
* Lots of control over the look (colors, cursors, and fonts and
  paragraph formatting, even in plain text mode)
* Normal app, user doesn't have to know about command line.

Maybe some ideas for us.
/Christian


--
Christian Ridderström, +46-8-768 39 44   http://www.md.kth.se/~chr

Re: [Cvslog] r22417 - /lyx-devel/branches/BRANCH_1_5_X/lib/ui/stdmenus...

2008-01-07 Thread Enrico Forestieri
On Mon, Jan 07, 2008 at 11:26:36PM +0200, Martin Vermeer wrote:
 On Mon, Jan 07, 2008 at 05:22:12PM +, [EMAIL PROTECTED] wrote:
  Author: lasgouttes
  Date: Mon Jan  7 18:22:11 2008
  New Revision: 22417
  
  URL: http://www.lyx.org/trac/changeset/22417
  Log:
  rename menu entries for numbering formulas
 
 ...
 
  Menu edit_math
  -   Item Toggle Numbering|N math-number
  -   Item Toggle Numbering of Line|u math-nonumber
  +   Item Number whole Formula|N math-number
  +   Item Number this Line|u math-nonumber
  Submenu Change Limits Type|L edit_math_limits
  Separator
  Submenu Change Formula Type|F edit_math_mutate
 
 
 This is not renaming, it's re-titling :-)

I find Number whole Formula to be quite misleading.
What about Activate Numbering instead?

-- 
Enrico


KDE-apps and LyX

2008-01-07 Thread Uwe Stöhr
Since this weekends' server down of kde.org, trolltech.com, and lyx.org, LyX is no longer listed in 
kdeapps:

http://www.kde-apps.org/content/show.php/LyX

Jürgen, could you contact the kde-apps team as you registered LyX there?

regards Uwe


Re: character counter

2008-01-07 Thread Pavel Sanda
  Is there any chance a character counter could be implemented into Lyx? It
  would be of great help when writing university papers

  such counter is quite simple. do we want it ?

 Absolutely! It was reported that this is a killer feature in some fields: 

this will be only informative counter. one reason is the different views
what is to be counted, the second one and much harder to implement is
the different number of actually typesetted chars by latex.
(maybe we can give such warning in the dialog?)

if nobody objects wrt the contrains above i will commit this later.
pavel
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 19e16da..d765d7f 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1143,24 +1143,26 @@ bool BufferView::dispatch(FuncRequest const  cmd)
from = doc_iterator_begin(buffer_.inset());
to = doc_iterator_end(buffer_.inset());
}
-   int const count = countWords(from, to);
+   pairint, int const count = countWords(from, to);
docstring message;
-   if (count != 1) {
+   if (count.first != 1) {
if (cur.selection())
-   message = bformat(_(%1$d words in selection.),
- count);
+   message = bformat(_(%1$d words, %2$d 
characters in selection.),
+ count.first, count.second);
else
-   message = bformat(_(%1$d words in 
document.),
- count);
+   message = bformat(_(%1$d words, %2$d 
characters in document.),
+ count.first, 
count.second);
}
else {
if (cur.selection())
-   message = _(One word in selection.);
+   message = bformat(_(One word, %1$d characters 
in selection.),
+ count.second);
else
-   message = _(One word in document.);
+   message = bformat(_(One word, %1$d characters 
in document.),
+ count.second);
}
 
-   Alert::information(_(Count words), message);
+   Alert::information(_(Count words and characters), message);
}
break;
 
diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp
index d38e3aa..26c5e87 100644
--- a/src/buffer_funcs.cpp
+++ b/src/buffer_funcs.cpp
@@ -160,9 +160,10 @@ Buffer * newUnnamedFile(string const  templatename, 
FileName const  path)
 }
 
 
-int countWords(DocIterator const  from, DocIterator const  to)
+std::pairint, int countWords(DocIterator const  from, DocIterator const  
to)
 {
int count = 0;
+   int chars = 0;
bool inword = false;
for (DocIterator dit = from ; dit != to ; dit.forwardPos()) {
// Copied and adapted from isLetter() in ControlSpellChecker
@@ -170,6 +171,7 @@ int countWords(DocIterator const  from, DocIterator const 
 to)
 dit.pos() != dit.lastpos()
 dit.paragraph().isLetter(dit.pos())
 !dit.paragraph().isDeleted(dit.pos())) {
+   ++chars;
if (!inword) {
++count;
inword = true;
@@ -178,7 +180,7 @@ int countWords(DocIterator const  from, DocIterator const 
 to)
inword = false;
}
 
-   return count;
+   return make_pair(count, chars);
 }
 
 
diff --git a/src/buffer_funcs.h b/src/buffer_funcs.h
index 061dc80..c1e3da9 100644
--- a/src/buffer_funcs.h
+++ b/src/buffer_funcs.h
@@ -41,8 +41,8 @@ Buffer * newFile(std::string const  filename, std::string 
const  templatename,
 Buffer * newUnnamedFile(std::string const  templatename,
support::FileName const  path);
 
-/// Count the number of words in the text between these two iterators
-int countWords(DocIterator const  from, DocIterator const  to);
+/// Count the number of words and characters in the text between these two 
iterators
+std::pairint, int countWords(DocIterator const  from, DocIterator const  
to);
 
 /// updates all counters
 void updateLabels(Buffer const , bool childonly = false);
diff --git a/src/lfuns.h b/src/lfuns.h
index 698c607..7c716b8 100644
--- a/src/lfuns.h
+++ b/src/lfuns.h
@@ -552,6 +552,15 @@ enum kb_action {
LFUN_INSET_REFRESH,
LFUN_BUFFER_NEXT,
LFUN_BUFFER_PREVIOUS,
+/**
+ * LFUN_WORDS_COUNT
+ * \li Action: Count the number of words and characters in the
+   document or in the given selection.
+ * \li Notion: Note that this function 

Re: LFUN Docs and LFUN Order

2008-01-07 Thread Pavel Sanda
 If so, couldn't that be done in some other way?  What if we just add for 
 instance a documentation section describing 'word-right', 'word-left', 
 'word-...' and then for the definition of 'word-right' etc , we refer to 
 that section.

i dont follow you exactly. can you show a code example of what you have in mind 
?
pavel


Re: [Cvslog] r22420 - /lyx-devel/trunk/lib/layouts/chess.layout

2008-01-07 Thread Jean-Marc Lasgouttes
[EMAIL PROTECTED] writes:

 Author: spitz
 Date: Mon Jan  7 19:15:49 2008
 New Revision: 22420

 URL: http://www.lyx.org/trac/changeset/22420
 Log:
 * lib/layouts/chess.layout:
   - require chess (instead of manually loading in the preamble).

Looks like the chess layout should be changed to a module (if there is
a reason to use this instead of an external inset).

JMarc


Re: [Cvslog] r22422 - /lyx-devel/trunk/src/lfuns.h

2008-01-07 Thread Jean-Marc Lasgouttes
Pavel Sanda [EMAIL PROTECTED] writes:

 Can't we just put the comments in the C++ file?

 if you show me how :)
 in other words i was not successful to generate doxygen output
 when putting the doxy entries in LyXAction.cpp. but i put just
 minimal effort to explore that possibility.

Do we really want to use doxygen on the file, or is he plan to write
some script that creates a wiki page or lyx document from this data?

JMarc


Re: [Cvslog] r22417 - /lyx-devel/branches/BRANCH_1_5_X/lib/ui/stdmenus...

2008-01-07 Thread Jean-Marc Lasgouttes
Martin Vermeer [EMAIL PROTECTED] writes:

 This is not renaming, it's re-titling :-)

I thought briefly about an alternative to rename, and failed. But I am
not sure I prefer re-title. Rephrase?

JMarc


Re: [Cvslog] r22417 - /lyx-devel/branches/BRANCH_1_5_X/lib/ui/stdmenus...

2008-01-07 Thread Jean-Marc Lasgouttes
Enrico Forestieri [EMAIL PROTECTED] writes:

 I find Number whole Formula to be quite misleading.
 What about Activate Numbering instead?

This looks more like the global pref Uwe wants to introduce, isn't it?

I am open to better ideas.

JMarc


Re: [Cvslog] r22422 - /lyx-devel/trunk/src/lfuns.h

2008-01-07 Thread Pavel Sanda
 Do we really want to use doxygen on the file, or is he plan to write
 some script that creates a wiki page or lyx document from this data?

i already use it. my intetion was to take the output html page and then
transform it little by some script. but its possible to forget all
about doxygen, put the comments in .cpp file and trnansform it from
there to html page. as you wish.

few days old doxygen is here:
http://www.jikos.cz/~ps/lyx/html/namespacelyx.html#95613ea29461d4a5df5db31a6d26641f0d3464f25212e5151e1270bbb7d6ad29

pavel


Re: [Cvslog] r22417 - /lyx-devel/branches/BRANCH_1_5_X/lib/ui/stdmenus...

2008-01-07 Thread Enrico Forestieri
On Mon, Jan 07, 2008 at 11:17:49PM +0100, Jean-Marc Lasgouttes wrote:
 Enrico Forestieri [EMAIL PROTECTED] writes:
 
  I find Number whole Formula to be quite misleading.
  What about Activate Numbering instead?
 
 This looks more like the global pref Uwe wants to introduce, isn't it?
 
 I am open to better ideas.

I don't follow you here. I am only suggesting

s/Number whole Formula/Activate Numbering/

as that is what will be done when the menu is checked.
Each line in the formula may well be unnumbered even though the
menu is checked. This is what I find misleading.

-- 
Enrico


Re: [Cvslog] r22417 - /lyx-devel/branches/BRANCH_1_5_X/lib/ui/stdmenus...

2008-01-07 Thread Jean-Marc Lasgouttes
Enrico Forestieri [EMAIL PROTECTED] writes:

 This looks more like the global pref Uwe wants to introduce, isn't it?
 
 I am open to better ideas.

 I don't follow you here. I am only suggesting

 s/Number whole Formula/Activate Numbering/

 as that is what will be done when the menu is checked.
 Each line in the formula may well be unnumbered even though the
 menu is checked. This is what I find misleading.

I understood what you suggest, but I feared it would look too much
like global setting, not per-math-inset.

Other opinions?

JMarc


Module Declaration Syntax

2008-01-07 Thread rgheck


I'm about to add some more functionality to the modules stuff, namely, 
an ability for a module to require another module, or to exclude 
one. For example, the Theorems and Theorems (AMS) modules should not be 
used together. The question is how to represent this information in the 
module files.


Note that this is information we want ultimately to turn up in 
lyxmodules.lst, which is produced by configure.py. So we're not talking 
about additional layout tags.


At present, we have something like this:

#\DeclareLyXModule[endnotes.sty]{Herein lies the description of the 
module.}{Endnote}


One possibility would be to add additional optional arguments for 
required and excluded packages. That would retain the LaTeX-like syntax, 
which I modeled on layout files themselves, thinking that at some point 
this might be integrated into chkconfig.ltx, the way layout files are. 
But if that's not going to happen, and I'm in no position to do that, 
then we could use some other system, and even bring the description out, 
perhaps like this:

#\DeclareLyXModule[endnotes.sty]{Endnote}
#BeginDescription
#Adds an endnote command, in addition to footnotes. You will need to add
#\theendnotes in ERT where you want the endnotes to appear.
#EndDescription
#Requires: Some Module; Some Other Module
#Excludes: Bad Module
This could then be parsed by configure.py, easily enough.

By the way: The requires here are meant to be treated disjunctively: You 
need ONE of the mentioned packages. The excludes will be treated 
conjunctively: NONE of the mentioned packages can be used. Seem sensible?


Thoughts?

Richard



Re: character counter

2008-01-07 Thread Andre Poenitz
On Mon, Jan 07, 2008 at 11:08:11PM +0100, Pavel Sanda wrote:
   Is there any chance a character counter could be implemented into Lyx? It
   would be of great help when writing university papers
 
   such counter is quite simple. do we want it ?
 
  Absolutely! It was reported that this is a killer feature in some fields: 
 
 this will be only informative counter. one reason is the different views
 what is to be counted, the second one and much harder to implement is
 the different number of actually typesetted chars by latex.
 (maybe we can give such warning in the dialog?)
 
 if nobody objects wrt the contrains above i will commit this later.
 pavel

 diff --git a/src/BufferView.cpp b/src/BufferView.cpp
 index 19e16da..d765d7f 100644
 --- a/src/BufferView.cpp
 +++ b/src/BufferView.cpp
 @@ -1143,24 +1143,26 @@ bool BufferView::dispatch(FuncRequest const  cmd)
   from = doc_iterator_begin(buffer_.inset());
   to = doc_iterator_end(buffer_.inset());
   }
 - int const count = countWords(from, to);
 + pairint, int const count = countWords(from, to);

Please use a real structuer with named items instead of a bunch on
anonymous ints. It's hard to guess which is words and which is chars
without looking at the actual use of the pair.

Andre'


Re: Showing a pin to the top-left corner of embedded figures.

2008-01-07 Thread Bo Peng
On Jan 7, 2008 1:02 PM, Bo Peng [EMAIL PROTECTED] wrote:
 The attached new pin.png has transparent background.

With the attached updated patch, the icon is updated with embedding
status changes.

I will apply the patch tomorrow if there is no objection.

Bo
Index: development/scons/scons_manifest.py
===
--- development/scons/scons_manifest.py	(revision 22418)
+++ development/scons/scons_manifest.py	(working copy)
@@ -1428,6 +1428,7 @@
 note-next.png
 paste.png
 promote.png
+pin.png
 psnfss1.png
 psnfss2.png
 psnfss3.png
Index: src/insets/InsetGraphics.cpp
===
--- src/insets/InsetGraphics.cpp	(revision 22418)
+++ src/insets/InsetGraphics.cpp	(working copy)
@@ -173,7 +173,7 @@
 		InsetGraphicsMailer::string2params(to_utf8(cmd.argument()), buffer, p);
 		if (!p.filename.empty()) {
 			try {
-updateEmbeddedFile(buffer, p.filename);
+p.filename.enable(buffer.embeddedFiles().enabled(), buffer);
 			} catch (ExceptionMessage const  message) {
 Alert::error(message.title_, message.details_);
 // do not set parameter if an error happens
Index: src/insets/InsetGraphicsParams.cpp
===
--- src/insets/InsetGraphicsParams.cpp	(revision 22418)
+++ src/insets/InsetGraphicsParams.cpp	(working copy)
@@ -274,6 +274,7 @@
 {
 	graphics::Params pars;
 	pars.filename = filename.availableFile();
+	pars.icon = filename.embedded() ? pin.png : ;
 	pars.scale = lyxscale;
 	pars.angle = convertdouble(rotateAngle);
 
Index: src/insets/RenderGraphic.h
===
--- src/insets/RenderGraphic.h	(revision 22418)
+++ src/insets/RenderGraphic.h	(working copy)
@@ -45,6 +45,7 @@
 
 	/// The stored data.
 	graphics::Loader loader_;
+	graphics::Loader icon_;
 	graphics::Params params_;
 };
 
Index: src/insets/RenderGraphic.cpp
===
--- src/insets/RenderGraphic.cpp	(revision 22418)
+++ src/insets/RenderGraphic.cpp	(working copy)
@@ -14,6 +14,8 @@
 
 #include insets/Inset.h
 
+#include support/FileName.h
+#include support/filetools.h
 #include support/gettext.h
 #include LyX.h
 #include LyXRC.h
@@ -36,13 +38,16 @@
 RenderGraphic::RenderGraphic(Inset const * inset)
 {
 	loader_.connect(boost::bind(Inset::updateFrontend, inset));
+	icon_.connect(boost::bind(Inset::updateFrontend, inset));
 }
 
 
 RenderGraphic::RenderGraphic(RenderGraphic const  other, Inset const * inset)
-	: RenderBase(other), loader_(other.loader_), params_(other.params_)
+	: RenderBase(other), loader_(other.loader_), icon_(other.icon_),
+		params_(other.params_)
 {
 	loader_.connect(boost::bind(Inset::updateFrontend, inset));
+	icon_.connect(boost::bind(Inset::updateFrontend, inset));
 }
 
 
@@ -58,6 +63,15 @@
 
 	if (!params_.filename.empty())
 		loader_.reset(params_.filename, params_);
+	// If icon is set to empty, icon_ will not be reset to empty
+	// but will not be displayed. This is to avoid repeated loading
+	// of the same icon when figure status changes.
+	if (!params_.icon.empty()) {
+		support::FileName const icon = support::libFileSearch(images/,
+			params_.icon, png);
+		if (!icon.empty()) // using an empty bounding box
+			icon_.reset(icon, graphics::Params());
+	}
 }
 
 
@@ -172,6 +186,10 @@
 			loader_.startLoading();
 		if (!loader_.monitoring())
 			loader_.startMonitoring();
+		if (icon_.status() == graphics::WaitingToLoad)
+			icon_.startLoading();
+		if (!icon_.monitoring())
+			icon_.startMonitoring();
 	}
 
 	// This will draw the graphics. If the graphics has not been
@@ -211,6 +229,9 @@
  y - 4, msg, msgFont);
 		}
 	}
+	if (!params_.icon.empty()  readyToDisplay(icon_))
+		pi.pain.image(x + Inset::TEXT_TO_INSET_OFFSET, y - dim_.asc, 
+			10, 10, *icon_.image());
 }
 
 
Index: src/graphics/GraphicsParams.cpp
===
--- src/graphics/GraphicsParams.cpp	(revision 22418)
+++ src/graphics/GraphicsParams.cpp	(working copy)
@@ -24,7 +24,8 @@
 Params::Params()
 	: display(ColorDisplay),
 	  scale(100),
-	  angle(0)
+	  angle(0),
+	  icon()
 {}
 
 
@@ -34,7 +35,8 @@
 		a.display == b.display 
 		a.bb == b.bb 
 		a.scale == b.scale 
-		a.angle == b.angle);
+		a.angle == b.angle 
+		a.icon == b.icon);
 }
 
 
Index: src/graphics/GraphicsParams.h
===
--- src/graphics/GraphicsParams.h	(revision 22418)
+++ src/graphics/GraphicsParams.h	(working copy)
@@ -72,6 +72,12 @@
 	 */
 	/// Rotation angle.
 	double angle;
+
+	/** The icon to be displayed to the top-left corner of an image.
+	 *  It is mutable because an icon reflects a temporary state of
+	 *  the image, and is variable.
+	 */
+	mutable std::string icon;
 };
 
 bool operator==(Params const , Params const );
Index: 

Re: character counter

2008-01-07 Thread Martin Vermeer
On Tue, Jan 08, 2008 at 12:46:18AM +0100, Andre Poenitz wrote:
 On Mon, Jan 07, 2008 at 11:08:11PM +0100, Pavel Sanda wrote:
Is there any chance a character counter could be implemented into Lyx? 
It
would be of great help when writing university papers
  
such counter is quite simple. do we want it ?
  
   Absolutely! It was reported that this is a killer feature in some fields: 
  
  this will be only informative counter. one reason is the different views
  what is to be counted, the second one and much harder to implement is
  the different number of actually typesetted chars by latex.
  (maybe we can give such warning in the dialog?)
  
  if nobody objects wrt the contrains above i will commit this later.
  pavel
 
  diff --git a/src/BufferView.cpp b/src/BufferView.cpp
  index 19e16da..d765d7f 100644
  --- a/src/BufferView.cpp
  +++ b/src/BufferView.cpp
  @@ -1143,24 +1143,26 @@ bool BufferView::dispatch(FuncRequest const  cmd)
  from = doc_iterator_begin(buffer_.inset());
  to = doc_iterator_end(buffer_.inset());
  }
  -   int const count = countWords(from, to);
  +   pairint, int const count = countWords(from, to);
 
 Please use a real structuer with named items instead of a bunch on
 anonymous ints. It's hard to guess which is words and which is chars
 without looking at the actual use of the pair.

What I was thinking... and easier to extend too.

- Martin
 


  1   2   3   >