RE: r33869 - in lyx-devel/trunk: . development/cmake

2010-03-29 Thread Vincent van Ravesteijn - TNW
 Moreover, it would be nice if one can set the GNUWIN32_DIR variable 
 within the user interface of Cmake. This is now not possible. Only the 
 GNUWIN32_DIR_tmp variable is visible in the gui.

I've committed a patch. Should work now.


Thanks. 

Next chance for improvement: The iconv.dll is not found automatically while it 
is in my dependency directory. Strangely the ICONV_DLL_HELP variable is found:

ICONV_DLL   ICONV_DLL-NOTFOUND
ICONV_DLL_HELP  D:/.../lyx-devel-deps/bin/iconv.dll
ICONV_INCLUDE_DIR   D:/.../lyx-devel-deps/include
ICONV_LIBRARY   D:/.../lyx-devel-deps/lib/iconv.lib

The Cmake error message is:

Cmake Error at modules/FindICONV.cmake:65(message):
  exit cmake
Call Stack (most recent call first):
  CMakeLists.txt:454 (find_package)

I don't understand what this ICONV_DLL_HELP is about (why do we search for 
iconv.dll twice, once with no default path and once with one) and why the 
following if is in the FindICONV.cmake file:

if(NOT ICONV_DLL AND ICONV_DLL_HELP)
exit
end

Vincent


Re: Naming LyxBlogger

2010-03-29 Thread Abdelrazak Younes

On 03/29/2010 04:37 AM, Jack Desert wrote:

What is the best name for a piece of software that connects LyX to a WordPress 
blog, publishing through xml-rpc?

If you have some creative ideas, let's hear them. Here are some suggestions:
   


lyx2wordpress

Unless of course this program can be used for other blog systems.

Abdel.




Re: Wishlist item: Copy as reference use the previously used reference format?

2010-03-29 Thread John McCabe-Dansted
On Wed, Mar 24, 2010 at 7:12 PM, Helge Hafting helge.haft...@hist.no wrote:
 Copy as reference is very useful - the writer avoids dialog boxes
 completely.

 But the reference format is always reference.

 Some documents use mostly reference on page page, or  maybe only
 page

 It'd be very nice if LyX could use the last reference format used, instead
 of just defaulting to reference. So, if the writer sets some
 other format, then this stays in effect thereafter. Then the writer is no
 longer forced to open dialogs to correct every reference.

 This shouldn't create any problems for those that prefer just reference
 either.

This seems like a good idea to me. I prefer to always just use
FrmtRef. (And manually add stuff like
\newrefformat{defn}{Definition~\ref{#1}} to my preamble so that
prettyref supports all the theorem types LyX supports, which I
understand won't be needed when the new improved RefStyle patch is
merged).

Actually I'd probably prefer to set it so that it always used FrmtRef,
as I'd find this simpler and faster since I'd rather not have to set
the default back to FrmtRef each time I use a plain reference, so
there is an argument to make this e.g. a lyxrc setting. It would be
simpler to use the last setting both in terms of implementation
(except that we have to consider what to do if the user hasn't chosen
any reference styles since LyX has last opened) and also that it is
one less configuration option the user has to set. So I don't have
strong feelings either way.

Perhaps the ideal would be to always default to FrmtRef and also have
FrmtRef satisfy the people who currently use plain reference. Why do
some people prefer the plain reference? Could the RefStyle patch
provide whatever they are missing in the current PrettyRef
implementation?

-- 
John C. McCabe-Dansted


RE: TocModel Read/Write to Buffer

2010-03-29 Thread Rob Oakes
Dear Abdel and Richard,

These are excellent points.

 But to tell the truth I am thinking that maybe we are on the wrong 
 track here... I mean, we'll never be able to have the full power of 
 LyX work area within the TocModel, just think about small insets, 
 labels, ERTs, etc.

 This is a very good point, come to think of it. Think about math. Or 
 even just emphasis.

 Indeed. Another solution would be to use EmbeddedWorkArea 
 for each section in the Model... That would be also nice...

It would be very nice to have this available.  I wonder if it would be
possible to use the EmbeddedWorkArea in a custom delegate?  In the original
prototype that I put together with python
(http://www.oak-tree.us/blog/index.php/science-and-technology/lyx-outline),
I did a great deal of experimentation with custom delegates, and found the
Qt model/delegate/view structure to be extremely flexible.  I am willing to
bed that the EmbeddedWorkArea could be used as editor, and quite possibly as
a viewer.

If so, wouldn't that provide access to most of LyX's editing features (Math,
emphasis, character styles, etc)?

Re: Outline View

I was actually hoping to have a dedicated Outline View or expanded
Outline Pane that would be separate from the main LyX view.  I implemented
a half-hearted attempt in the python prototype.

It was initially my hope that the outline view would be more than a place
for setting up the structure of the document (though that would certainly be
a *big* part of it).  It would also bring together a synopsis of
particular sections, and possibly even keywords.  (I was planning on adding
these other pieces of information via specialized insets, similar to the
note inset.)  I was also hoping that the Outline View, like the
Corkboard, could be used for understanding the logical flow of the text.  As
a result, it could also be used to reorganize and tweak the rhetorical flow
from a very high level. 

This is how the Word processor, Scrivener, on Mac OS X works
(http://www.literatureandlatte.com/scrivener.html); and it offers an
extremely compelling experience.  As someone who is highly scatterbrained,
it meshes nicely with my writing style.

Moreover, I don't think it would be terribly difficult to implement a
similar experience inside of LyX (or at least, it wouldn't be terribly
difficult if I knew what I was doing ;) ).  It mostly requires a robust
model that can both read from the buffer, and commit changes.  And the
ability to funnel certain types of information into different rows/columns. 

Since the TocModel classes can already differentiate between types of
content/insets (shown by the ability to separately list tables, figures,
etc.), how hard might it be to create new model columns for a specialized
Synopsis inset?  I've already created the specialized views and would
merely need to adapt them, maybe by incorporating the EmbeddedWorkArea as a
custom delegate?

Thoughts?

Rob



Re: TocModel Read/Write to Buffer

2010-03-29 Thread Abdelrazak Younes

On 03/29/2010 04:05 PM, Rob Oakes wrote:

Dear Abdel and Richard,

These are excellent points.

   

But to tell the truth I am thinking that maybe we are on the wrong
track here... I mean, we'll never be able to have the full power of
 

LyX work area within the TocModel, just think about small insets,
labels, ERTs, etc.

This is a very good point, come to think of it. Think about math. Or
even just emphasis.
   
   

Indeed. Another solution would be to use EmbeddedWorkArea
for each section in the Model... That would be also nice...
 

It would be very nice to have this available.  I wonder if it would be
possible to use the EmbeddedWorkArea in a custom delegate?  In the original
prototype that I put together with python
(http://www.oak-tree.us/blog/index.php/science-and-technology/lyx-outline),
I did a great deal of experimentation with custom delegates, and found the
Qt model/delegate/view structure to be extremely flexible.  I am willing to
bed that the EmbeddedWorkArea could be used as editor, and quite possibly as
a viewer.

If so, wouldn't that provide access to most of LyX's editing features (Math,
emphasis, character styles, etc)?
   


Yes.


Re: Outline View

I was actually hoping to have a dedicated Outline View or expanded
Outline Pane that would be separate from the main LyX view.  I implemented
a half-hearted attempt in the python prototype.

It was initially my hope that the outline view would be more than a place
for setting up the structure of the document (though that would certainly be
a *big* part of it).  It would also bring together a synopsis of
particular sections, and possibly even keywords.  (I was planning on adding
these other pieces of information via specialized insets, similar to the
note inset.)


Yes, that's what I was about to suggest. Have a look at flex inset.


   I was also hoping that the Outline View, like the
Corkboard, could be used for understanding the logical flow of the text.  As
a result, it could also be used to reorganize and tweak the rhetorical flow
from a very high level.

This is how the Word processor, Scrivener, on Mac OS X works
(http://www.literatureandlatte.com/scrivener.html); and it offers an
extremely compelling experience.  As someone who is highly scatterbrained,
it meshes nicely with my writing style.

Moreover, I don't think it would be terribly difficult to implement a
similar experience inside of LyX (or at least, it wouldn't be terribly
difficult if I knew what I was doing ;) ).  It mostly requires a robust
model that can both read from the buffer, and commit changes.  And the
ability to funnel certain types of information into different rows/columns.

Since the TocModel classes can already differentiate between types of
content/insets (shown by the ability to separately list tables, figures,
etc.), how hard might it be to create new model columns for a specialized
Synopsis inset?


Easy :-)

You just have to define a synopsis toc type and implement addToToc() 
for this synopsis inset. I would guess that this method will have to 
look at both the toc type and the synopsis type... maybe pasting the 
content of the previous section into a dedicated internal Buffer 
container. You'll have to work out the details :-)




   I've already created the specialized views and would
merely need to adapt them, maybe by incorporating the EmbeddedWorkArea as a
custom delegate?
   


Should be possible indeed.

This project sounds like a very fun challenge!

Abdel.



RE: How do I use toggle-dialog?

2010-03-29 Thread Rob Oakes
Dear LyX Developers,

Thank you to everyone who provided suggestions.  I finally managed to get it to 
work.  For my own notes (and the wonderful list archives), here is a summary 
what was needed to use toggle-dialog:

1.) Create a DockWidget container that is similar to GuiToc, GuiProgressView, 
or GuiViewSource.

...

GuiTestMod::GuiTestMod(GuiView  parent, Qt::DockWidgetArea area,
Qt::WindowFlags flags) : DockView(parent, testmod, qt_(Testmod), area, 
flags),
is_closing_(false)

...

2.) Add an entry to the dialognames[] structure:

Char const * const dialognames[] = {aboutlyx, bibitem, ... progress, 
testmod};

3.) Define a createTestMod method in GuiView::build( ... ):

...
Dialog *createGuiTestMod(GuiView  lv);

...

if (name == corkboard)
return createGuiTestMod(*this);

4.) Add an entry to stdmenus.inc or stdtoolbars.inc so that it appears in the 
LyX UI:

Item Test Model Dialog dialog-toggle testmod

Again, thank you everyone for the help.  Your comments saved me hours of 
poking, prodding and head scratching.

Cheers,

Rob



RE: Importing doc documents

2010-03-29 Thread Rob Oakes
Hi Richard,

Interesting project.  Thanks for the link.  I'll need to play with this and
see if I can get it to work.  I've been looking for a way of getting from MS
Word to LyX and back, and this might help to automate some of it.

With that said, I had a thought.  It seems that I surrounded by happy and
singing students that are applying for Google code fellowships and otherwise
having hysterics over summer plans.  While it is too late for LyX to submit
proposals this year, I wonder if trying to get Summer of Code students to
work on MS Word/LyX converters might make for a good project next year?

LyX already imports/exports to nearly every other format under the sun
(through the use of external tools, I know), it seems like an oversight to
leave out the Word processor used by most people.  If you really wanted to
get fancy, you could try and convert tracked changes and comments from the
LyX system into MS Word, or vice-versa.  A more robust path for document
interchange with Word users would go a *long* way to helping LyX adoption.
I have several colleagues who would love to use it, but need a better way of
working with MS Word users.

I'm not sure what LyX's history with Google's Summer of Code is, but if
there is any interest, I'd be happy to help with filing applications and
such.  I'm not sure that I'm qualified to be a mentor, but I could be a
ruthlessly competent coordinator.

Cheers,

Rob Oakes



Re: Request for review of lyx2lyx changes

2010-03-29 Thread rgheck

On 03/28/2010 12:32 PM, Vincent van Ravesteijn wrote:

Hi All,

Can someone please check the lyx2lyx routines I added in

Author: vfr
Date: Sun Mar 28 16:52:47 2010
New Revision: 33891
URL: http://www.lyx.org/trac/changeset/33891

and

Author: vfr
Date: Sun Mar 28 18:29:25 2010
New Revision: 33893
URL: http://www.lyx.org/trac/changeset/33893


I'll comment on them from the cvs logs.

rh



Re: r33891 - in lyx-devel/trunk: lib/lyx2lyx src

2010-03-29 Thread rgheck

On 03/28/2010 10:52 AM, v...@lyx.org wrote:

Modified: lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py
==
--- lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 15:47:50 2010
(r33890)
+++ lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 16:52:47 2010
(r33891)
@@ -1237,6 +1237,33 @@
  document.header[i] = \\html_use_mathml  + newval


+
+def revert_inset_preview(document):
+ Dissolves the preview inset 
+i = 0
+j = 0
+k = 0
+while True:
+  i = find_token(document.body, \\begin_inset Preview, i)
+  if i == -1:
+  return
+  j = find_end_of_inset(document.body, i)
+  if j == -1:
+  document.warning(Malformed LyX document: Could not find end of Preview 
inset.)
+  return
+  #If the layout is Standard we need to remove it, otherwise there
+  #will be paragraph breaks that shouldn't be there.
+  k = find_token(document.body, \\begin_layout Standard, i)
+  if k == i+2:
+  del document.body[i : i+3]
+  del document.body[j-5 : j-2]
+  i -= 6
+  else:
+  del document.body[i]
+  del document.body[j-1]
+  i -= 2
+
   

This can't be right. Suppose we have this structure:
this is text [ now in a preview ] now out again.
with the preview inset containing something in anything but standard, 
say verse. Then we get:


\begin_layout Standard
this is text

\begin_layout Verse
now in a preview
\end_layout


now out again
\end_layout

which is not a valid document.

Note that the LaTeX is a bit odd, too in this case:

this is tex and \begin{verse}

now in a preview

\end{verse}

now out again.


So I wonder whether you should not enforce the plain layout here, which 
has no LaTeX content and which could just always be removed, restoring 
the situation.



Relatedly, you are allowing an InsetPreview to contain multiple 
paragraphs. I'm not sure we should allow that. An InsetPreview is 
inline, unlike a footnote, so having multiple paragraphs in the middle 
of a line seems like a weird thing to do.


So, the proposal: InsetPreview should set MultiPar false and ForcePlain 
true. Then adjust the LyX to LyX to always remove the internal layout.


Finally, I got a crash I can't seem to replicate but did get twice. 
Roughly: Turn preview on. Create an InsetPreview with just an ERT in it. 
Delete the ERT. The cursor seemed to jump in front of the inset, then 
the crash.


rh



Re: r33893 - in lyx-devel/trunk: development lib/lyx2lyx src

2010-03-29 Thread rgheck

On 03/28/2010 12:29 PM, v...@lyx.org wrote:

Modified: lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py
==
--- lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 18:22:17 2010
(r33892)
+++ lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 18:29:25 2010
(r33893)
@@ -1262,7 +1262,42 @@
del document.body[i]
del document.body[j-1]
i -= 2
+

+def revert_equalspacing_xymatrix(document):
+ Revert a Formula with xymat...@! to an ERT inset 
+i = 0
+j = 0
+has_preamble = 0
+while True:
+  found = -1
+  i = find_token(document.body, \\begin_inset Formula, i)
+  if i == -1:
+  break
+  j = find_end_of_inset(document.body, i)
+  if j == -1:
+  document.warning(Malformed LyX document: Could not find end of Formula 
inset.)
+  break
+
+  for curline in range(len(document.body[i:j])):
+  found = document.body[i+curline].find(\\xymat...@!)
+  if found != -1:
+  break
+
+  if found != -1:
+  content = document.body[i][21:]
+  for curline in range(len(document.body[i+1:j])):
+  content += document.body[i+1+curline]
+  subst = [put_cmd_in_ert(content)]
+  document.body[i:j+1] = subst
+  else:
+  for curline in range(len(document.body[i:j])):
+  l = document.body[i+curline].find(\\xymatrix)
+  if l != -1:
+  has_preamble = 1;
+  i += 1
+if has_preamble == 0:
+add_to_preamble(document, ['\\usepackage[all]{xy}'])

   
This last seems slightly wrong, as we're adding this to the preamble 
even if we never found a \\xymat...@! line. I'll fix that and commit a 
slightly more pythonic version of the whole thing. Please check that I 
didn't break it.


rh



Re: Letters floating- Low quality

2010-03-29 Thread rgheck

On 03/29/2010 10:41 AM, YURENA MENDOZA wrote:

I have returned to check, and only  appear those three kind of letters.

I think you are looking under Default Family rather than under 
Roman. Under Roman, you should have lots of choices for the default 
Roman font.


rh



2010/3/29 rgheck rgh...@bobjweil.com mailto:rgh...@bobjweil.com

On 03/29/2010 08:08 AM, YURENA MENDOZA wrote:

Hello, when my work is transfered  to pdf the quality of the
letters in the
pdf (version 8) is very low specially letters of the
 floating. What can I
do? In addition I can only choose between three kind of
letter: time roman,
sans-serif and typewriter, which package can I install, which
is its actual
name? Because I have read that the lmodern contains several
types of
letters but I dont know which lmodern package I should download.


You are right that this is a font issue. Look under
DocumentSettingsFonts, and see if you do not have more options
under Roman.

rh






Re: r33924 - in lyx-devel/trunk: lib/layouts po src

2010-03-29 Thread rgheck

On 03/29/2010 04:01 PM, rgh...@lyx.org wrote:

Author: rgheck
Date: Mon Mar 29 22:01:28 2010
New Revision: 33924
URL: http://www.lyx.org/trac/changeset/33924

Log:
Introduce a simple macro facility for citation formats. Also introduce
simple, translatable units for use in such formats.

   
So I gather I have to delete lyx.pot to generate the new translation 
stuff. Should I do that and then commit the result? or will someone else 
do that somewhere along the way?


rh



Re: r33924 - in lyx-devel/trunk: lib/layouts po src

2010-03-29 Thread Pavel Sanda
Richard Heck wrote:
 Log:
 Introduce a simple macro facility for citation formats. Also introduce
 simple, translatable units for use in such formats.


 So I gather I have to delete lyx.pot to generate the new translation stuff. 
 Should I do that and then commit the result? or will someone else do that 
 somewhere along the way?

it happens somewhere along the way.
you can even do it yourself, bopefully your gettext makes the same format
of .po files.

pavel


Re: r33869 - in lyx-devel/trunk: . development/cmake

2010-03-29 Thread Peter Kümmel
Vincent van Ravesteijn - TNW wrote:
 Moreover, it would be nice if one can set the GNUWIN32_DIR variable 
 within the user interface of Cmake. This is now not possible. Only the 
 GNUWIN32_DIR_tmp variable is visible in the gui.
 I've committed a patch. Should work now.

 
 Thanks. 
 
 Next chance for improvement: The iconv.dll is not found automatically while 
 it is in my dependency directory. Strangely the ICONV_DLL_HELP variable is 
 found:
 
 ICONV_DLL ICONV_DLL-NOTFOUND
 ICONV_DLL_HELPD:/.../lyx-devel-deps/bin/iconv.dll
 ICONV_INCLUDE_DIR D:/.../lyx-devel-deps/include
 ICONV_LIBRARY D:/.../lyx-devel-deps/lib/iconv.lib
 
 The Cmake error message is:
 
 Cmake Error at modules/FindICONV.cmake:65(message):
   exit cmake
 Call Stack (most recent call first):
   CMakeLists.txt:454 (find_package)
 
 I don't understand what this ICONV_DLL_HELP is about (why do we search for 
 iconv.dll twice, once with no default path and once with one) and why the 
 following if is in the FindICONV.cmake file:

'find_file(ICONV_DLL': This ensures iconv.dll is in the scope of your PATH 
variable, because it must also
be found at runtime, not only when building lyx. So, while searching for 
ICONV_DLL_ all cmake specific
search pathes are ignored: NO_DEFAULT_PATH

But yes, for building ICONV_DLL_HELP is superfluous and having only 
ICONV_LIBRARY should be enough.
ICONV_DLL_HELP is only good for writing the path to iconv.dll in the error 
message.

Peter

 
 if(NOT ICONV_DLL AND ICONV_DLL_HELP)
 exit
 end
 
 Vincent
 


Re: r33924 - in lyx-devel/trunk: lib/layouts po src

2010-03-29 Thread rgheck

On 03/29/2010 04:12 PM, Pavel Sanda wrote:

Richard Heck wrote:
   

Log:
Introduce a simple macro facility for citation formats. Also introduce
simple, translatable units for use in such formats.


   

So I gather I have to delete lyx.pot to generate the new translation stuff.
Should I do that and then commit the result? or will someone else do that
somewhere along the way?
 

it happens somewhere along the way.
you can even do it yourself, bopefully your gettext makes the same format
of .po files.

   

ok, i'll try it. it can always be reverted.

rh



Re: Patch Submission: LyxBlogger Converters

2010-03-29 Thread rgheck

On 03/28/2010 08:52 PM, Jack Desert wrote:
   

LyxBlogger is specifically set up to parse the LyXHTML and eLyXer formats. Some 
features may turn out strange using TtH, Hevea, or latex2html, simply because 
the regular expressions may not find what they're looking for.

So yes, let's leave the html -  blog converter inside the if block so a 
newbie doesn't get unexpected results right out of the gate.

-Jack

 

In presenting the user with a preconfigured format and converter for 
LyxBlogger, I have two primary aims:

1. That we guess correctly most of the time which converter the user will 
want to use, and enable it by default.

2. That the user be able to select the other converter as painlessly as 
possible if we guessed wrong.

That said, of course a plain Jane system should use xhtml -  blog by default because 
that's all that will be available. But if someone has gone to the trouble of installing 
eLyXer, it makes sense to present html -  blog as the default instead. On the outside 
chance that we guessed wrong on this one, reverting to LyXHTML is as simple as modifying the 
LyxBlogger converter from   html---blog   to   xhtml---blog   in 
Preferences-Converters.

I have put together a patch that illustrates this. The following lines are 
added to lyxrc.defaults based on which programs are found on the machine:

A. Lyxblogger not installed
 ( no entry )

B. LyxBlogger installed, eLyXer not installed
 \Formatblog   blog   LyxBlogger   
document
 \converter xhtml  blog   lyxblogger $$i   

C. LyxBlogger and eLyXer installed
 \Formatblog   blog   LyxBlogger   
document
 \converter html   blog   lyxblogger $$i   

   

OK, this looks good. I'll commit shortly.

Could you send a standard GPL message to the list, such as:
http://marc.info/?l=lyx-develm=117501689204059
I'm not sure we need it for this, but it'll get you listed as a contributor.

rh



LyX Weirdness

2010-03-29 Thread rgheck


I'm seeing some weird trunk behavior today, as shown here:
http://bobjweil.com/sales/lyx.png
This happened after doing FileNew while editing the Customization 
manual. But I'm also seeing this kind of thing when opening LyX, though 
it seems to flash quickly and then disappear. Could be a local problem, 
I'd supposed, but I haven't updated the system, so Qt etc haven't 
changed. I'm also not using the updateBuffer() patch locally.


rh



Re: LyX 2.0 release plan

2010-03-29 Thread Jean-Marc Lasgouttes

Le 29 mars 10 à 00:58, Pavel Sanda a écrit :

Pavel Sanda wrote:
I'll go through the enh bugs with 2.0 target and leave only those  
which are
really to be included. For this I need somebody create two new  
milestones in

trac for postponing - 2.1.0  2.0.1.


ding ding dong dong ;)



Done.

I thought my apathy would be enough to have Juergen do it, but he won.

JMarc

RE: LyX Weirdness

2010-03-29 Thread Vincent van Ravesteijn - TNW
 
I'm seeing some weird trunk behavior today, as shown here:
 http://bobjweil.com/sales/lyx.png

Did you update my last fix for the mistake I made ?

Vincent


Re: GuiHyperlink.cpp - compilation warning

2010-03-29 Thread Uwe Stöhr

 There are nevertheless 2 issues left:

 - the files in LyX's lib folder are not copied to a Resources folder in the
 folder where I have
 build LyX. LyX therefore won't start when double-clicking on the lyx.exe.
 (SCons automatically creates the Resources folder and update its contents
 also automatically at the end of the compilation.)

 Without installing it doesn't run out-off-the-box from the debugger.
 You have to set LYX_DIR_20x=lyx-dir/lib. You could add it global or in
 the Settings dialog for the lyx project which you must have marked as
 starting project.

This is not my point. I meant that I need the feature that all files in the SVN lib folder are 
automatically copied to the LYX_DIR_20x or another folder (or another folder) after the compilation. 
This way I have automatically an up-to-date, fully functional LyX SVN test version.


 - How can I remerge and compile the po-files?

This is also a key feature for me. How can this be done?

thanks and regards
Uwe


Re: LyX Weirdness

2010-03-29 Thread rgheck

On 03/29/2010 05:46 PM, Vincent van Ravesteijn - TNW wrote:


   

I'm seeing some weird trunk behavior today, as shown here:
 http://bobjweil.com/sales/lyx.png
 

Did you update my last fix for the mistake I made ?

   

Apparently not. Thanks.

rh



[patch] support to set the document-wide text color

2010-03-29 Thread Uwe Stöhr

It's easter time so here's my easter egg ;-) : support to set the document-wide 
text color.

It seems that people need this and implementing support for this was very easy because the code is 
basically the same as the one for the page background color.


It works well for me except of that I cannot set the font color of the tooltip in Qt's designer by 
default to white and black on black is unreadable. Any idea how this can be done?


regards Uwe
Index: lib/lyx2lyx/lyx_2_0.py
===
--- lib/lyx2lyx/lyx_2_0.py	(revision 33937)
+++ lib/lyx2lyx/lyx_2_0.py	(working copy)
@@ -1338,6 +1338,45 @@
 if has_equal_spacing and not has_preamble:
 add_to_preamble(document, ['\\usepackage[all]{xy}'])
 
+
+def revert_fontcolor(document):
+ Reverts font color to preamble code 
+i = 0
+colorcode = 
+while True:
+  i = find_token(document.header, \\fontcolor, i)
+  if i == -1:
+  return
+  colorcode = get_value(document.header, '\\fontcolor', 0)
+  del document.header[i]
+  # don't clutter the preamble if backgroundcolor is not set
+  if colorcode == #00:
+  continue
+  # the color code is in the form #rrggbb where every character denotes a hex number
+  # convert the string to an int
+  red = string.atoi(colorcode[1:3],16)
+  # we want the output 0.5 for the value 127 therefore add here
+  if red != 0:
+  red = red + 1
+  redout = float(red) / 256
+  green = string.atoi(colorcode[3:5],16)
+  if green != 0:
+  green = green + 1
+  greenout = float(green) / 256
+  blue = string.atoi(colorcode[5:7],16)
+  if blue != 0:
+  blue = blue + 1
+  blueout = float(blue) / 256
+  # write the preamble
+  insert_to_preamble(0, document,
+   '% Commands inserted by lyx2lyx to set the font color\n'
+   + '\...@ifundefined{definecolor}{\\usepackage{color}}{}\n'
+   + '\\definecolor{document_fontcolor}{rgb}{'
+   + str(redout) + ', ' + str(greenout)
+   + ', ' + str(blueout) + '}\n'
+   + '\\color{document_fontcolor}\n')
+
+
 ##
 # Conversion hub
 #
@@ -1378,10 +1417,12 @@
[378, []],
[379, [convert_math_output]],
[380, []],
-   [381, []]
+   [381, []],
+   [382, []]
   ]
 
-revert =  [[380, [revert_equalspacing_xymatrix]],
+revert =  [[381, [revert_fontcolor]],
+   [380, [revert_equalspacing_xymatrix]],
[379, [revert_inset_preview]],
[378, [revert_math_output]],
[377, []],
Index: src/Buffer.cpp
===
--- src/Buffer.cpp	(revision 33937)
+++ src/Buffer.cpp	(working copy)
@@ -126,7 +126,7 @@
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 381; // vfr: new parameters for xymatrix
+int const LYX_FORMAT = 382; // uwestoehr: support to set document-wide font color
 
 typedef mapstring, bool DepClean;
 typedef mapdocstring, pairInsetLabel const *, Buffer::References  RefCache;
@@ -668,6 +668,7 @@
 	params().pdfoptions().clear();
 	params().indiceslist().clear();
 	params().backgroundcolor = lyx::rgbFromHexName(#ff);
+	params().fontcolor = lyx::rgbFromHexName(#00);
 
 	for (int i = 0; i  4; ++i) {
 		params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
Index: src/BufferParams.cpp
===
--- src/BufferParams.cpp	(revision 33937)
+++ src/BufferParams.cpp	(working copy)
@@ -369,6 +369,8 @@
 	suppress_date = false;
 	// white is equal to no background color
 	backgroundcolor = lyx::rgbFromHexName(#ff);
+	// black is equal to no font color
+	fontcolor = lyx::rgbFromHexName(#00);
 	compressed = lyxrc.save_compressed;
 	for (int iter = 0; iter  4; ++iter) {
 		user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
@@ -721,6 +723,9 @@
 	} else if (token == \\backgroundcolor) {
 		lex.eatLine();
 		backgroundcolor = lyx::rgbFromHexName(lex.getString());
+	} else if (token == \\fontcolor) {
+		lex.eatLine();
+		fontcolor = lyx::rgbFromHexName(lex.getString());
 	} else if (token == \\paperwidth) {
 		lex  paperwidth;
 	} else if (token == \\paperheight) {
@@ -913,6 +918,8 @@
 	'\n';
 	   if (backgroundcolor != lyx::rgbFromHexName(#ff))
 		os  \\backgroundcolor   lyx::X11hexname(backgroundcolor)  '\n';
+	   if (fontcolor != lyx::rgbFromHexName(#00))
+		os  \\fontcolor   lyx::X11hexname(fontcolor)  '\n';
 
 	BranchList::const_iterator it = branchlist().begin();
 	BranchList::const_iterator end = branchlist().end();
@@ -1442,6 +1449,15 @@
 		features.require(pagecolor);
 	}
 
+	// only output when the font color is not black
+	if (fontcolor != 

Re: Enhancement bugs for 2.0

2010-03-29 Thread Uwe Stöhr

 * http://www.lyx.org/trac/ticket/3865
 implement to define color definitions in document settings

 i guess c. Uwe?

 This issue is very complicated because we have to store all colors that the 
user might already
 have defined previously in a document. For stability reasons of 2.0, I would 
strongly recommend
 to postpone this to 2.1.

This statement was wrong because I mixed
http://www.lyx.org/trac/ticket/3865
with
http://www.lyx.org/trac/ticket/1841

I fix for http://www.lyx.org/trac/ticket/3865 is easy. The fix for 
http://www.lyx.org/trac/ticket/3865 too.

The only question I have is where to place the button to select the color for 
notes in the UI.
Any idea?

regards Uwe


[patch] fix #3865 - support to change the font color for greyed-out notes

2010-03-29 Thread Uwe Stöhr

Attached is a patch for
http://www.lyx.org/trac/ticket/3865
This would of course be a fileformat change.

I placed the button to change the color in the font dialog since this setting only affects the font 
color within this kind of notes.


In my previous patch I haven't changed the document-wide text color within LyX because I have seen 
that some users prefer to have completely different colors in the LyX UI, e.g white text and black 
background.
In this case I changed also the on-screen color because this setting affects only a small portion of 
text and we do the same when the users changes the text color of a selection.


I would like to fix http://www.lyx.org/trac/ticket/3863 the same way as this one but don't know yet 
where to place the button to change the color.


regards Uwe
Index: lib/layouts/stdinsets.inc
===
--- lib/layouts/stdinsets.inc	(revision 33947)
+++ lib/layouts/stdinsets.inc	(working copy)
@@ -160,6 +160,9 @@
 	LatexType environment
 	LatexName lyxgreyedout
 	BgColor   greyedoutbg
+	Font
+	  Color   greyedouttext
+	EndFont
 	LabelFont
 	  Color   greyedout
 	  SizeSmall
Index: src/Buffer.cpp
===
--- src/Buffer.cpp	(revision 33947)
+++ src/Buffer.cpp	(working copy)
@@ -668,6 +668,7 @@
 	params().pdfoptions().clear();
 	params().indiceslist().clear();
 	params().backgroundcolor = lyx::rgbFromHexName(#ff);
+	params().notefontcolor = lyx::rgbFromHexName(#cc);
 
 	for (int i = 0; i  4; ++i) {
 		params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
Index: src/BufferParams.cpp
===
--- src/BufferParams.cpp	(revision 33947)
+++ src/BufferParams.cpp	(working copy)
@@ -369,6 +369,8 @@
 	suppress_date = false;
 	// white is equal to no background color
 	backgroundcolor = lyx::rgbFromHexName(#ff);
+	// light gray is the default font color for greyed-out notes
+	notefontcolor = lyx::rgbFromHexName(#cc);
 	compressed = lyxrc.save_compressed;
 	for (int iter = 0; iter  4; ++iter) {
 		user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
@@ -721,6 +723,9 @@
 	} else if (token == \\backgroundcolor) {
 		lex.eatLine();
 		backgroundcolor = lyx::rgbFromHexName(lex.getString());
+	} else if (token == \\notefontcolor) {
+		lex.eatLine();
+		notefontcolor = lyx::rgbFromHexName(lex.getString());
 	} else if (token == \\paperwidth) {
 		lex  paperwidth;
 	} else if (token == \\paperheight) {
@@ -913,6 +918,8 @@
 	'\n';
 	   if (backgroundcolor != lyx::rgbFromHexName(#ff))
 		os  \\backgroundcolor   lyx::X11hexname(backgroundcolor)  '\n';
+	   if (notefontcolor != lyx::rgbFromHexName(#cc))
+		os  \\notefontcolor   lyx::X11hexname(notefontcolor)  '\n';
 
 	BranchList::const_iterator it = branchlist().begin();
 	BranchList::const_iterator end = branchlist().end();
Index: src/BufferParams.h
===
--- src/BufferParams.h	(revision 33947)
+++ src/BufferParams.h	(working copy)
@@ -288,6 +288,8 @@
 	std::string pagestyle;
 	///
 	RGBColor backgroundcolor;
+	///
+	RGBColor notefontcolor;
 	/// \param index should lie in the range 0 = \c index = 3.
 	Bullet  temp_bullet(size_type index);
 	Bullet const  temp_bullet(size_type index) const;
Index: src/Color.cpp
===
--- src/Color.cpp	(revision 33947)
+++ src/Color.cpp	(working copy)
@@ -181,6 +181,7 @@
 	{ Color_commentlabel, N_(comment label), comment, magenta, comment },
 	{ Color_commentbg, N_(comment background), commentbg, linen, commentbg },
 	{ Color_greyedoutlabel, N_(greyedout inset label), greyedout, #ff0080, greyedout },
+	{ Color_greyedouttext, N_(greyedout inset text), greyedouttext, grey80, greyedouttext },
 	{ Color_greyedoutbg, N_(greyedout inset background), greyedoutbg, linen, greyedoutbg },
 	{ Color_phantomtext, N_(phantom inset text), phantomtext, #7f7f7f, phantomtext },
 	{ Color_shadedbg, N_(shaded box), shaded, #ff, shaded },
Index: src/ColorCode.h
===
--- src/ColorCode.h	(revision 33947)
+++ src/ColorCode.h	(working copy)
@@ -65,6 +65,8 @@
 	Color_commentbg,
 	/// Label color for greyedout insets
 	Color_greyedoutlabel,
+	/// Color for greyedout inset text
+	Color_greyedouttext,
 	/// Background color of greyedout inset
 	Color_greyedoutbg,
 	/// Background color of shaded box
Index: src/frontends/qt4/GuiDocument.cpp
===
--- src/frontends/qt4/GuiDocument.cpp	(revision 33947)
+++ src/frontends/qt4/GuiDocument.cpp	(working copy)
@@ -29,6 +29,7 @@
 #include BufferParams.h
 #include BufferView.h
 #include Color.h
+#include ColorSet.h
 #include ColorCache.h
 #include Encoding.h
 #include FloatPlacement.h

RE: r33869 - in lyx-devel/trunk: . development/cmake

2010-03-29 Thread Vincent van Ravesteijn - TNW
>> Moreover, it would be nice if one can set the GNUWIN32_DIR variable 
>> within the user interface of Cmake. This is now not possible. Only the 
>> GNUWIN32_DIR_tmp variable is visible in the gui.
>
>I've committed a patch. Should work now.
>

Thanks. 

Next chance for improvement: The iconv.dll is not found automatically while it 
is in my dependency directory. Strangely the ICONV_DLL_HELP variable is found:

ICONV_DLL   ICONV_DLL-NOTFOUND
ICONV_DLL_HELP  D:/.../lyx-devel-deps/bin/iconv.dll
ICONV_INCLUDE_DIR   D:/.../lyx-devel-deps/include
ICONV_LIBRARY   D:/.../lyx-devel-deps/lib/iconv.lib

The Cmake error message is:

Cmake Error at modules/FindICONV.cmake:65(message):
  exit cmake
Call Stack (most recent call first):
  CMakeLists.txt:454 (find_package)

I don't understand what this ICONV_DLL_HELP is about (why do we search for 
iconv.dll twice, once with no default path and once with one) and why the 
following if is in the FindICONV.cmake file:

if(NOT ICONV_DLL AND ICONV_DLL_HELP)
exit
end

Vincent


Re: Naming LyxBlogger

2010-03-29 Thread Abdelrazak Younes

On 03/29/2010 04:37 AM, Jack Desert wrote:

What is the best name for a piece of software that connects LyX to a WordPress 
blog, publishing through xml-rpc?

If you have some creative ideas, let's hear them. Here are some suggestions:
   


lyx2wordpress

Unless of course this program can be used for other blog systems.

Abdel.




Re: Wishlist item: "Copy as reference" use the previously used reference format?

2010-03-29 Thread John McCabe-Dansted
On Wed, Mar 24, 2010 at 7:12 PM, Helge Hafting  wrote:
> "Copy as reference" is very useful - the writer avoids dialog boxes
> completely.
>
> But the reference format is always "".
>
> Some documents use mostly " on page ", or  maybe only
> ""
>
> It'd be very nice if LyX could use the "last reference format used", instead
> of just defaulting to . So, if the writer sets some
> other format, then this stays in effect thereafter. Then the writer is no
> longer forced to open dialogs to correct every reference.
>
> This shouldn't create any problems for those that prefer just 
> either.

This seems like a good idea to me. I prefer to always just use
FrmtRef. (And manually add stuff like
\newrefformat{defn}{Definition~\ref{#1}} to my preamble so that
prettyref supports all the theorem types LyX supports, which I
understand won't be needed when the new improved RefStyle patch is
merged).

Actually I'd probably prefer to set it so that it always used FrmtRef,
as I'd find this simpler and faster since I'd rather not have to set
the default back to FrmtRef each time I use a plain , so
there is an argument to make this e.g. a lyxrc setting. It would be
simpler to use the last setting both in terms of implementation
(except that we have to consider what to do if the user hasn't chosen
any reference styles since LyX has last opened) and also that it is
one less configuration option the user has to set. So I don't have
strong feelings either way.

Perhaps the ideal would be to always default to FrmtRef and also have
FrmtRef satisfy the people who currently use plain . Why do
some people prefer the plain ? Could the RefStyle patch
provide whatever they are missing in the current PrettyRef
implementation?

-- 
John C. McCabe-Dansted


RE: TocModel Read/Write to Buffer

2010-03-29 Thread Rob Oakes
Dear Abdel and Richard,

These are excellent points.

>>> But to tell the truth I am thinking that maybe we are on the wrong 
>>> track here... I mean, we'll never be able to have the full power of 
>> LyX work area within the TocModel, just think about small insets, 
>> labels, ERTs, etc.
>>
>> This is a very good point, come to think of it. Think about math. Or 
>> even just emphasis.

> Indeed. Another solution would be to use EmbeddedWorkArea 
> for each section in the Model... That would be also nice...

It would be very nice to have this available.  I wonder if it would be
possible to use the EmbeddedWorkArea in a custom delegate?  In the original
prototype that I put together with python
(http://www.oak-tree.us/blog/index.php/science-and-technology/lyx-outline),
I did a great deal of experimentation with custom delegates, and found the
Qt model/delegate/view structure to be extremely flexible.  I am willing to
bed that the EmbeddedWorkArea could be used as editor, and quite possibly as
a viewer.

If so, wouldn't that provide access to most of LyX's editing features (Math,
emphasis, character styles, etc)?

Re: Outline View

I was actually hoping to have a dedicated "Outline View" or expanded
"Outline Pane" that would be separate from the main LyX view.  I implemented
a half-hearted attempt in the python prototype.

It was initially my hope that the outline view would be more than a place
for setting up the structure of the document (though that would certainly be
a *big* part of it).  It would also bring together a "synopsis" of
particular sections, and possibly even keywords.  (I was planning on adding
these other pieces of information via specialized insets, similar to the
"note" inset.)  I was also hoping that the "Outline View", like the
Corkboard, could be used for understanding the logical flow of the text.  As
a result, it could also be used to reorganize and tweak the rhetorical flow
from a very high level. 

This is how the Word processor, Scrivener, on Mac OS X works
(http://www.literatureandlatte.com/scrivener.html); and it offers an
extremely compelling experience.  As someone who is highly scatterbrained,
it meshes nicely with my writing style.

Moreover, I don't think it would be terribly difficult to implement a
similar experience inside of LyX (or at least, it wouldn't be terribly
difficult if I knew what I was doing ;) ).  It mostly requires a robust
model that can both read from the buffer, and commit changes.  And the
ability to funnel certain types of information into different rows/columns. 

Since the TocModel classes can already differentiate between types of
content/insets (shown by the ability to separately list tables, figures,
etc.), how hard might it be to create new model columns for a specialized
"Synopsis" inset?  I've already created the specialized views and would
merely need to adapt them, maybe by incorporating the EmbeddedWorkArea as a
custom delegate?

Thoughts?

Rob



Re: TocModel Read/Write to Buffer

2010-03-29 Thread Abdelrazak Younes

On 03/29/2010 04:05 PM, Rob Oakes wrote:

Dear Abdel and Richard,

These are excellent points.

   

But to tell the truth I am thinking that maybe we are on the wrong
track here... I mean, we'll never be able to have the full power of
 

LyX work area within the TocModel, just think about small insets,
labels, ERTs, etc.

This is a very good point, come to think of it. Think about math. Or
even just emphasis.
   
   

Indeed. Another solution would be to use EmbeddedWorkArea
for each section in the Model... That would be also nice...
 

It would be very nice to have this available.  I wonder if it would be
possible to use the EmbeddedWorkArea in a custom delegate?  In the original
prototype that I put together with python
(http://www.oak-tree.us/blog/index.php/science-and-technology/lyx-outline),
I did a great deal of experimentation with custom delegates, and found the
Qt model/delegate/view structure to be extremely flexible.  I am willing to
bed that the EmbeddedWorkArea could be used as editor, and quite possibly as
a viewer.

If so, wouldn't that provide access to most of LyX's editing features (Math,
emphasis, character styles, etc)?
   


Yes.


Re: Outline View

I was actually hoping to have a dedicated "Outline View" or expanded
"Outline Pane" that would be separate from the main LyX view.  I implemented
a half-hearted attempt in the python prototype.

It was initially my hope that the outline view would be more than a place
for setting up the structure of the document (though that would certainly be
a *big* part of it).  It would also bring together a "synopsis" of
particular sections, and possibly even keywords.  (I was planning on adding
these other pieces of information via specialized insets, similar to the
"note" inset.)


Yes, that's what I was about to suggest. Have a look at flex inset.


   I was also hoping that the "Outline View", like the
Corkboard, could be used for understanding the logical flow of the text.  As
a result, it could also be used to reorganize and tweak the rhetorical flow
from a very high level.

This is how the Word processor, Scrivener, on Mac OS X works
(http://www.literatureandlatte.com/scrivener.html); and it offers an
extremely compelling experience.  As someone who is highly scatterbrained,
it meshes nicely with my writing style.

Moreover, I don't think it would be terribly difficult to implement a
similar experience inside of LyX (or at least, it wouldn't be terribly
difficult if I knew what I was doing ;) ).  It mostly requires a robust
model that can both read from the buffer, and commit changes.  And the
ability to funnel certain types of information into different rows/columns.

Since the TocModel classes can already differentiate between types of
content/insets (shown by the ability to separately list tables, figures,
etc.), how hard might it be to create new model columns for a specialized
"Synopsis" inset?


Easy :-)

You just have to define a "synopsis" toc type and implement addToToc() 
for this "synopsis" inset. I would guess that this method will have to 
look at both the "toc" type and the "synopsis" type... maybe pasting the 
content of the previous section into a dedicated internal Buffer 
container. You'll have to work out the details :-)




   I've already created the specialized views and would
merely need to adapt them, maybe by incorporating the EmbeddedWorkArea as a
custom delegate?
   


Should be possible indeed.

This project sounds like a very fun challenge!

Abdel.



RE: How do I use toggle-dialog?

2010-03-29 Thread Rob Oakes
Dear LyX Developers,

Thank you to everyone who provided suggestions.  I finally managed to get it to 
work.  For my own notes (and the wonderful list archives), here is a summary 
what was needed to use toggle-dialog:

1.) Create a DockWidget container that is similar to GuiToc, GuiProgressView, 
or GuiViewSource.

...

GuiTestMod::GuiTestMod(GuiView & parent, Qt::DockWidgetArea area,
Qt::WindowFlags flags) : DockView(parent, "testmod", qt_("Testmod"), area, 
flags),
is_closing_(false)

...

2.) Add an entry to the "dialognames[]" structure:

Char const * const dialognames[] = {"aboutlyx", "bibitem", ... "progress", 
"testmod"};

3.) Define a createTestMod method in GuiView::build( ... ):

...
Dialog *createGuiTestMod(GuiView & lv);

...

if (name == "corkboard")
return createGuiTestMod(*this);

4.) Add an entry to stdmenus.inc or stdtoolbars.inc so that it appears in the 
LyX UI:

Item "Test Model Dialog" "dialog-toggle testmod"

Again, thank you everyone for the help.  Your comments saved me hours of 
poking, prodding and head scratching.

Cheers,

Rob



RE: Importing doc documents

2010-03-29 Thread Rob Oakes
Hi Richard,

Interesting project.  Thanks for the link.  I'll need to play with this and
see if I can get it to work.  I've been looking for a way of getting from MS
Word to LyX and back, and this might help to automate some of it.

With that said, I had a thought.  It seems that I surrounded by happy and
singing students that are applying for Google code fellowships and otherwise
having hysterics over summer plans.  While it is too late for LyX to submit
proposals this year, I wonder if trying to get Summer of Code students to
work on MS Word/LyX converters might make for a good project next year?

LyX already imports/exports to nearly every other format under the sun
(through the use of external tools, I know), it seems like an oversight to
leave out the Word processor used by most people.  If you really wanted to
get fancy, you could try and convert tracked changes and comments from the
LyX system into MS Word, or vice-versa.  A more robust path for document
interchange with Word users would go a *long* way to helping LyX adoption.
I have several colleagues who would love to use it, but need a better way of
working with MS Word users.

I'm not sure what LyX's history with Google's Summer of Code is, but if
there is any interest, I'd be happy to help with filing applications and
such.  I'm not sure that I'm qualified to be a mentor, but I could be a
ruthlessly competent coordinator.

Cheers,

Rob Oakes



Re: Request for review of lyx2lyx changes

2010-03-29 Thread rgheck

On 03/28/2010 12:32 PM, Vincent van Ravesteijn wrote:

Hi All,

Can someone please check the lyx2lyx routines I added in

Author: vfr
Date: Sun Mar 28 16:52:47 2010
New Revision: 33891
URL: http://www.lyx.org/trac/changeset/33891

and

Author: vfr
Date: Sun Mar 28 18:29:25 2010
New Revision: 33893
URL: http://www.lyx.org/trac/changeset/33893


I'll comment on them from the cvs logs.

rh



Re: r33891 - in lyx-devel/trunk: lib/lyx2lyx src

2010-03-29 Thread rgheck

On 03/28/2010 10:52 AM, v...@lyx.org wrote:

Modified: lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py
==
--- lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 15:47:50 2010
(r33890)
+++ lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 16:52:47 2010
(r33891)
@@ -1237,6 +1237,33 @@
  document.header[i] = "\\html_use_mathml " + newval


+
+def revert_inset_preview(document):
+" Dissolves the preview inset "
+i = 0
+j = 0
+k = 0
+while True:
+  i = find_token(document.body, "\\begin_inset Preview", i)
+  if i == -1:
+  return
+  j = find_end_of_inset(document.body, i)
+  if j == -1:
+  document.warning("Malformed LyX document: Could not find end of Preview 
inset.")
+  return
+  #If the layout is Standard we need to remove it, otherwise there
+  #will be paragraph breaks that shouldn't be there.
+  k = find_token(document.body, "\\begin_layout Standard", i)
+  if k == i+2:
+  del document.body[i : i+3]
+  del document.body[j-5 : j-2]
+  i -= 6
+  else:
+  del document.body[i]
+  del document.body[j-1]
+  i -= 2
+
   

This can't be right. Suppose we have this structure:
this is text [ now in a preview ] now out again.
with the preview inset containing something in anything but standard, 
say verse. Then we get:


\begin_layout Standard
this is text

\begin_layout Verse
now in a preview
\end_layout


now out again
\end_layout

which is not a valid document.

Note that the LaTeX is a bit odd, too in this case:

this is tex and \begin{verse}

now in a preview

\end{verse}

now out again.


So I wonder whether you should not enforce the plain layout here, which 
has no LaTeX content and which could just always be removed, restoring 
the situation.



Relatedly, you are allowing an InsetPreview to contain multiple 
paragraphs. I'm not sure we should allow that. An InsetPreview is 
"inline", unlike a footnote, so having multiple paragraphs in the middle 
of a line seems like a weird thing to do.


So, the proposal: InsetPreview should set MultiPar false and ForcePlain 
true. Then adjust the LyX to LyX to always remove the "internal" layout.


Finally, I got a crash I can't seem to replicate but did get twice. 
Roughly: Turn preview on. Create an InsetPreview with just an ERT in it. 
Delete the ERT. The cursor seemed to jump in front of the inset, then 
the crash.


rh



Re: r33893 - in lyx-devel/trunk: development lib/lyx2lyx src

2010-03-29 Thread rgheck

On 03/28/2010 12:29 PM, v...@lyx.org wrote:

Modified: lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py
==
--- lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 18:22:17 2010
(r33892)
+++ lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py  Sun Mar 28 18:29:25 2010
(r33893)
@@ -1262,7 +1262,42 @@
del document.body[i]
del document.body[j-1]
i -= 2
+

+def revert_equalspacing_xymatrix(document):
+" Revert a Formula with xymat...@! to an ERT inset "
+i = 0
+j = 0
+has_preamble = 0
+while True:
+  found = -1
+  i = find_token(document.body, "\\begin_inset Formula", i)
+  if i == -1:
+  break
+  j = find_end_of_inset(document.body, i)
+  if j == -1:
+  document.warning("Malformed LyX document: Could not find end of Formula 
inset.")
+  break
+
+  for curline in range(len(document.body[i:j])):
+  found = document.body[i+curline].find("\\xymat...@!")
+  if found != -1:
+  break
+
+  if found != -1:
+  content = document.body[i][21:]
+  for curline in range(len(document.body[i+1:j])):
+  content += document.body[i+1+curline]
+  subst = [put_cmd_in_ert(content)]
+  document.body[i:j+1] = subst
+  else:
+  for curline in range(len(document.body[i:j])):
+  l = document.body[i+curline].find("\\xymatrix")
+  if l != -1:
+  has_preamble = 1;
+  i += 1
+if has_preamble == 0:
+add_to_preamble(document, ['\\usepackage[all]{xy}'])

   
This last seems slightly wrong, as we're adding this to the preamble 
even if we never found a \\xymat...@! line. I'll fix that and commit a 
slightly more pythonic version of the whole thing. Please check that I 
didn't break it.


rh



Re: Letters floating- Low quality

2010-03-29 Thread rgheck

On 03/29/2010 10:41 AM, YURENA MENDOZA wrote:

I have returned to check, and only  appear those three kind of letters.

I think you are looking under "Default Family" rather than under 
"Roman". Under Roman, you should have lots of choices for the default 
Roman font.


rh



2010/3/29 rgheck >

On 03/29/2010 08:08 AM, YURENA MENDOZA wrote:

Hello, when my work is transfered  to pdf the quality of the
letters in the
pdf (version 8) is very low specially letters of the
 floating. What can I
do? In addition I can only choose between three kind of
letter: time roman,
sans-serif and typewriter, which package can I install, which
is its actual
name? Because I have read that the "lmodern" contains several
types of
letters but I dont know which lmodern package I should download.


You are right that this is a font issue. Look under
Document>Settings>Fonts, and see if you do not have more options
under Roman.

rh






Re: r33924 - in lyx-devel/trunk: lib/layouts po src

2010-03-29 Thread rgheck

On 03/29/2010 04:01 PM, rgh...@lyx.org wrote:

Author: rgheck
Date: Mon Mar 29 22:01:28 2010
New Revision: 33924
URL: http://www.lyx.org/trac/changeset/33924

Log:
Introduce a simple macro facility for citation formats. Also introduce
simple, translatable units for use in such formats.

   
So I gather I have to delete lyx.pot to generate the new translation 
stuff. Should I do that and then commit the result? or will someone else 
do that somewhere along the way?


rh



Re: r33924 - in lyx-devel/trunk: lib/layouts po src

2010-03-29 Thread Pavel Sanda
Richard Heck wrote:
>> Log:
>> Introduce a simple macro facility for citation formats. Also introduce
>> simple, translatable units for use in such formats.
>>
>>
> So I gather I have to delete lyx.pot to generate the new translation stuff. 
> Should I do that and then commit the result? or will someone else do that 
> somewhere along the way?

it happens somewhere along the way.
you can even do it yourself, bopefully your gettext makes the same format
of .po files.

pavel


Re: r33869 - in lyx-devel/trunk: . development/cmake

2010-03-29 Thread Peter Kümmel
Vincent van Ravesteijn - TNW wrote:
>>> Moreover, it would be nice if one can set the GNUWIN32_DIR variable 
>>> within the user interface of Cmake. This is now not possible. Only the 
>>> GNUWIN32_DIR_tmp variable is visible in the gui.
>> I've committed a patch. Should work now.
>>
> 
> Thanks. 
> 
> Next chance for improvement: The iconv.dll is not found automatically while 
> it is in my dependency directory. Strangely the ICONV_DLL_HELP variable is 
> found:
> 
> ICONV_DLL ICONV_DLL-NOTFOUND
> ICONV_DLL_HELPD:/.../lyx-devel-deps/bin/iconv.dll
> ICONV_INCLUDE_DIR D:/.../lyx-devel-deps/include
> ICONV_LIBRARY D:/.../lyx-devel-deps/lib/iconv.lib
> 
> The Cmake error message is:
> 
> Cmake Error at modules/FindICONV.cmake:65(message):
>   exit cmake
> Call Stack (most recent call first):
>   CMakeLists.txt:454 (find_package)
> 
> I don't understand what this ICONV_DLL_HELP is about (why do we search for 
> iconv.dll twice, once with no default path and once with one) and why the 
> following if is in the FindICONV.cmake file:

'find_file(ICONV_DLL': This ensures iconv.dll is in the scope of your PATH 
variable, because it must also
be found at runtime, not only when building lyx. So, while searching for 
ICONV_DLL_ all cmake specific
search pathes are ignored: NO_DEFAULT_PATH

But yes, for building ICONV_DLL_HELP is superfluous and having only 
ICONV_LIBRARY should be enough.
ICONV_DLL_HELP is only good for writing the path to iconv.dll in the error 
message.

Peter

> 
> if(NOT ICONV_DLL AND ICONV_DLL_HELP)
> exit
> end
> 
> Vincent
> 


Re: r33924 - in lyx-devel/trunk: lib/layouts po src

2010-03-29 Thread rgheck

On 03/29/2010 04:12 PM, Pavel Sanda wrote:

Richard Heck wrote:
   

Log:
Introduce a simple macro facility for citation formats. Also introduce
simple, translatable units for use in such formats.


   

So I gather I have to delete lyx.pot to generate the new translation stuff.
Should I do that and then commit the result? or will someone else do that
somewhere along the way?
 

it happens somewhere along the way.
you can even do it yourself, bopefully your gettext makes the same format
of .po files.

   

ok, i'll try it. it can always be reverted.

rh



Re: Patch Submission: LyxBlogger Converters

2010-03-29 Thread rgheck

On 03/28/2010 08:52 PM, Jack Desert wrote:
   

LyxBlogger is specifically set up to parse the LyXHTML and eLyXer formats. Some 
features may turn out strange using TtH, Hevea, or latex2html, simply because 
the regular expressions may not find what they're looking for.

So yes, let's leave the html ->  blog converter inside the "if" block so a 
newbie doesn't get unexpected results right out of the gate.

-Jack

 

In presenting the user with a preconfigured format and converter for 
LyxBlogger, I have two primary aims:

1. That we guess correctly most of the time which converter the user will 
want to use, and enable it by default.

2. That the user be able to select the other converter as painlessly as 
possible if we guessed wrong.

That said, of course a plain Jane system should use xhtml ->  blog by default because 
that's all that will be available. But if someone has gone to the trouble of installing 
eLyXer, it makes sense to present html ->  blog as the default instead. On the outside 
chance that we guessed wrong on this one, reverting to LyXHTML is as simple as modifying the 
LyxBlogger converter from   html--->blog   to   xhtml--->blog   in 
Preferences->Converters.

I have put together a patch that illustrates this. The following lines are 
added to lyxrc.defaults based on which programs are found on the machine:

A. Lyxblogger not installed
 ( no entry )

B. LyxBlogger installed, eLyXer not installed
 \Formatblog   blog   "LyxBlogger"   "" "" ""  
"document"
 \converter xhtml  blog   "lyxblogger $$i"   ""

C. LyxBlogger and eLyXer installed
 \Formatblog   blog   "LyxBlogger"   "" "" ""  
"document"
 \converter html   blog   "lyxblogger $$i"   ""

   

OK, this looks good. I'll commit shortly.

Could you send a standard GPL message to the list, such as:
http://marc.info/?l=lyx-devel=117501689204059
I'm not sure we need it for this, but it'll get you listed as a contributor.

rh



LyX Weirdness

2010-03-29 Thread rgheck


I'm seeing some weird trunk behavior today, as shown here:
http://bobjweil.com/sales/lyx.png
This happened after doing File>New while editing the Customization 
manual. But I'm also seeing this kind of thing when opening LyX, though 
it seems to flash quickly and then disappear. Could be a local problem, 
I'd supposed, but I haven't updated the system, so Qt etc haven't 
changed. I'm also not using the updateBuffer() patch locally.


rh



Re: LyX 2.0 release plan

2010-03-29 Thread Jean-Marc Lasgouttes

Le 29 mars 10 à 00:58, Pavel Sanda a écrit :

Pavel Sanda wrote:
I'll go through the enh bugs with 2.0 target and leave only those  
which are
really to be included. For this I need somebody create two new  
milestones in

trac for postponing - 2.1.0 & 2.0.1.


ding ding dong dong ;)



Done.

I thought my apathy would be enough to have Juergen do it, but he won.

JMarc

RE: LyX Weirdness

2010-03-29 Thread Vincent van Ravesteijn - TNW
 
>I'm seeing some weird trunk behavior today, as shown here:
> http://bobjweil.com/sales/lyx.png

Did you update my last fix for the mistake I made ?

Vincent


Re: GuiHyperlink.cpp - compilation warning

2010-03-29 Thread Uwe Stöhr

> There are nevertheless 2 issues left:
>
>> - the files in LyX's lib folder are not copied to a "Resources" folder in the
>> folder where I have
>> build LyX. LyX therefore won't start when double-clicking on the lyx.exe.
>> (SCons automatically creates the Resources folder and update its contents
>> also automatically at the end of the compilation.)
>
> Without installing it doesn't run out-off-the-box from the debugger.
> You have to set LYX_DIR_20x=/lib. You could add it global or in
> the Settings dialog for the lyx project which you must have marked as
> starting project.

This is not my point. I meant that I need the feature that all files in the SVN "lib" folder are 
automatically copied to the LYX_DIR_20x or another folder (or another folder) after the compilation. 
This way I have automatically an up-to-date, fully functional LyX SVN test version.


>> - How can I remerge and compile the po-files?

This is also a key feature for me. How can this be done?

thanks and regards
Uwe


Re: LyX Weirdness

2010-03-29 Thread rgheck

On 03/29/2010 05:46 PM, Vincent van Ravesteijn - TNW wrote:


   

I'm seeing some weird trunk behavior today, as shown here:
 http://bobjweil.com/sales/lyx.png
 

Did you update my last fix for the mistake I made ?

   

Apparently not. Thanks.

rh



[patch] support to set the document-wide text color

2010-03-29 Thread Uwe Stöhr

It's easter time so here's my easter egg ;-) : support to set the document-wide 
text color.

It seems that people need this and implementing support for this was very easy because the code is 
basically the same as the one for the page background color.


It works well for me except of that I cannot set the font color of the tooltip in Qt's designer by 
default to white and black on black is unreadable. Any idea how this can be done?


regards Uwe
Index: lib/lyx2lyx/lyx_2_0.py
===
--- lib/lyx2lyx/lyx_2_0.py	(revision 33937)
+++ lib/lyx2lyx/lyx_2_0.py	(working copy)
@@ -1338,6 +1338,45 @@
 if has_equal_spacing and not has_preamble:
 add_to_preamble(document, ['\\usepackage[all]{xy}'])
 
+
+def revert_fontcolor(document):
+" Reverts font color to preamble code "
+i = 0
+colorcode = ""
+while True:
+  i = find_token(document.header, "\\fontcolor", i)
+  if i == -1:
+  return
+  colorcode = get_value(document.header, '\\fontcolor', 0)
+  del document.header[i]
+  # don't clutter the preamble if backgroundcolor is not set
+  if colorcode == "#00":
+  continue
+  # the color code is in the form #rrggbb where every character denotes a hex number
+  # convert the string to an int
+  red = string.atoi(colorcode[1:3],16)
+  # we want the output "0.5" for the value "127" therefore add here
+  if red != 0:
+  red = red + 1
+  redout = float(red) / 256
+  green = string.atoi(colorcode[3:5],16)
+  if green != 0:
+  green = green + 1
+  greenout = float(green) / 256
+  blue = string.atoi(colorcode[5:7],16)
+  if blue != 0:
+  blue = blue + 1
+  blueout = float(blue) / 256
+  # write the preamble
+  insert_to_preamble(0, document,
+   '% Commands inserted by lyx2lyx to set the font color\n'
+   + '\...@ifundefined{definecolor}{\\usepackage{color}}{}\n'
+   + '\\definecolor{document_fontcolor}{rgb}{'
+   + str(redout) + ', ' + str(greenout)
+   + ', ' + str(blueout) + '}\n'
+   + '\\color{document_fontcolor}\n')
+
+
 ##
 # Conversion hub
 #
@@ -1378,10 +1417,12 @@
[378, []],
[379, [convert_math_output]],
[380, []],
-   [381, []]
+   [381, []],
+   [382, []]
   ]
 
-revert =  [[380, [revert_equalspacing_xymatrix]],
+revert =  [[381, [revert_fontcolor]],
+   [380, [revert_equalspacing_xymatrix]],
[379, [revert_inset_preview]],
[378, [revert_math_output]],
[377, []],
Index: src/Buffer.cpp
===
--- src/Buffer.cpp	(revision 33937)
+++ src/Buffer.cpp	(working copy)
@@ -126,7 +126,7 @@
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 381; // vfr: new parameters for xymatrix
+int const LYX_FORMAT = 382; // uwestoehr: support to set document-wide font color
 
 typedef map DepClean;
 typedef map RefCache;
@@ -668,6 +668,7 @@
 	params().pdfoptions().clear();
 	params().indiceslist().clear();
 	params().backgroundcolor = lyx::rgbFromHexName("#ff");
+	params().fontcolor = lyx::rgbFromHexName("#00");
 
 	for (int i = 0; i < 4; ++i) {
 		params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
Index: src/BufferParams.cpp
===
--- src/BufferParams.cpp	(revision 33937)
+++ src/BufferParams.cpp	(working copy)
@@ -369,6 +369,8 @@
 	suppress_date = false;
 	// white is equal to no background color
 	backgroundcolor = lyx::rgbFromHexName("#ff");
+	// black is equal to no font color
+	fontcolor = lyx::rgbFromHexName("#00");
 	compressed = lyxrc.save_compressed;
 	for (int iter = 0; iter < 4; ++iter) {
 		user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
@@ -721,6 +723,9 @@
 	} else if (token == "\\backgroundcolor") {
 		lex.eatLine();
 		backgroundcolor = lyx::rgbFromHexName(lex.getString());
+	} else if (token == "\\fontcolor") {
+		lex.eatLine();
+		fontcolor = lyx::rgbFromHexName(lex.getString());
 	} else if (token == "\\paperwidth") {
 		lex >> paperwidth;
 	} else if (token == "\\paperheight") {
@@ -913,6 +918,8 @@
 	   << '\n';
 	   if (backgroundcolor != lyx::rgbFromHexName("#ff"))
 		os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
+	   if (fontcolor != lyx::rgbFromHexName("#00"))
+		os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
 
 	BranchList::const_iterator it = branchlist().begin();
 	BranchList::const_iterator end = branchlist().end();
@@ -1442,6 +1449,15 @@
 		features.require("pagecolor");
 	}
 
+	// only output when the font color is not black
+	if (fontcolor 

Re: Enhancement bugs for 2.0

2010-03-29 Thread Uwe Stöhr

>> * http://www.lyx.org/trac/ticket/3865
>> implement to define color definitions in document settings
>>
>> i guess c. Uwe?
>
> This issue is very complicated because we have to store all colors that the 
user might already
> have defined previously in a document. For stability reasons of 2.0, I would 
strongly recommend
> to postpone this to 2.1.

This statement was wrong because I mixed
http://www.lyx.org/trac/ticket/3865
with
http://www.lyx.org/trac/ticket/1841

I fix for http://www.lyx.org/trac/ticket/3865 is easy. The fix for 
http://www.lyx.org/trac/ticket/3865 too.

The only question I have is where to place the button to select the color for 
notes in the UI.
Any idea?

regards Uwe


[patch] fix #3865 - support to change the font color for greyed-out notes

2010-03-29 Thread Uwe Stöhr

Attached is a patch for
http://www.lyx.org/trac/ticket/3865
This would of course be a fileformat change.

I placed the button to change the color in the font dialog since this setting only affects the font 
color within this kind of notes.


In my previous patch I haven't changed the document-wide text color within LyX because I have seen 
that some users prefer to have completely different colors in the LyX UI, e.g white text and black 
background.
In this case I changed also the on-screen color because this setting affects only a small portion of 
text and we do the same when the users changes the text color of a selection.


I would like to fix http://www.lyx.org/trac/ticket/3863 the same way as this one but don't know yet 
where to place the button to change the color.


regards Uwe
Index: lib/layouts/stdinsets.inc
===
--- lib/layouts/stdinsets.inc	(revision 33947)
+++ lib/layouts/stdinsets.inc	(working copy)
@@ -160,6 +160,9 @@
 	LatexType environment
 	LatexName lyxgreyedout
 	BgColor   greyedoutbg
+	Font
+	  Color   greyedouttext
+	EndFont
 	LabelFont
 	  Color   greyedout
 	  SizeSmall
Index: src/Buffer.cpp
===
--- src/Buffer.cpp	(revision 33947)
+++ src/Buffer.cpp	(working copy)
@@ -668,6 +668,7 @@
 	params().pdfoptions().clear();
 	params().indiceslist().clear();
 	params().backgroundcolor = lyx::rgbFromHexName("#ff");
+	params().notefontcolor = lyx::rgbFromHexName("#cc");
 
 	for (int i = 0; i < 4; ++i) {
 		params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
Index: src/BufferParams.cpp
===
--- src/BufferParams.cpp	(revision 33947)
+++ src/BufferParams.cpp	(working copy)
@@ -369,6 +369,8 @@
 	suppress_date = false;
 	// white is equal to no background color
 	backgroundcolor = lyx::rgbFromHexName("#ff");
+	// light gray is the default font color for greyed-out notes
+	notefontcolor = lyx::rgbFromHexName("#cc");
 	compressed = lyxrc.save_compressed;
 	for (int iter = 0; iter < 4; ++iter) {
 		user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
@@ -721,6 +723,9 @@
 	} else if (token == "\\backgroundcolor") {
 		lex.eatLine();
 		backgroundcolor = lyx::rgbFromHexName(lex.getString());
+	} else if (token == "\\notefontcolor") {
+		lex.eatLine();
+		notefontcolor = lyx::rgbFromHexName(lex.getString());
 	} else if (token == "\\paperwidth") {
 		lex >> paperwidth;
 	} else if (token == "\\paperheight") {
@@ -913,6 +918,8 @@
 	   << '\n';
 	   if (backgroundcolor != lyx::rgbFromHexName("#ff"))
 		os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
+	   if (notefontcolor != lyx::rgbFromHexName("#cc"))
+		os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
 
 	BranchList::const_iterator it = branchlist().begin();
 	BranchList::const_iterator end = branchlist().end();
Index: src/BufferParams.h
===
--- src/BufferParams.h	(revision 33947)
+++ src/BufferParams.h	(working copy)
@@ -288,6 +288,8 @@
 	std::string pagestyle;
 	///
 	RGBColor backgroundcolor;
+	///
+	RGBColor notefontcolor;
 	/// \param index should lie in the range 0 <= \c index <= 3.
 	Bullet & temp_bullet(size_type index);
 	Bullet const & temp_bullet(size_type index) const;
Index: src/Color.cpp
===
--- src/Color.cpp	(revision 33947)
+++ src/Color.cpp	(working copy)
@@ -181,6 +181,7 @@
 	{ Color_commentlabel, N_("comment label"), "comment", "magenta", "comment" },
 	{ Color_commentbg, N_("comment background"), "commentbg", "linen", "commentbg" },
 	{ Color_greyedoutlabel, N_("greyedout inset label"), "greyedout", "#ff0080", "greyedout" },
+	{ Color_greyedouttext, N_("greyedout inset text"), "greyedouttext", grey80, "greyedouttext" },
 	{ Color_greyedoutbg, N_("greyedout inset background"), "greyedoutbg", "linen", "greyedoutbg" },
 	{ Color_phantomtext, N_("phantom inset text"), "phantomtext", "#7f7f7f", "phantomtext" },
 	{ Color_shadedbg, N_("shaded box"), "shaded", "#ff", "shaded" },
Index: src/ColorCode.h
===
--- src/ColorCode.h	(revision 33947)
+++ src/ColorCode.h	(working copy)
@@ -65,6 +65,8 @@
 	Color_commentbg,
 	/// Label color for greyedout insets
 	Color_greyedoutlabel,
+	/// Color for greyedout inset text
+	Color_greyedouttext,
 	/// Background color of greyedout inset
 	Color_greyedoutbg,
 	/// Background color of shaded box
Index: src/frontends/qt4/GuiDocument.cpp
===
--- src/frontends/qt4/GuiDocument.cpp	(revision 33947)
+++ src/frontends/qt4/GuiDocument.cpp	(working copy)
@@ -29,6 +29,7 @@
 #include "BufferParams.h"
 #include "BufferView.h"