Re: 2007 LyX Meeting: Invitation
Jean-Marc Lasgouttes wrote: Too bad. Is it because you do not want us to discover that you are actually a Spanish girl (and moreover mathematician)? Damn! How did you find out? Jürgen
[patch] bug 2520: Make InsetExternal translateable
http://bugzilla.lyx.org/show_bug.cgi?id=2520 The attached patch does this (I think it's the last remaining non-translatable ui part). Kudos to Neil Muller for his Python help. Remaining clumsyness is obviously my own, since I implemented it somewhat differently. Opinions? Jürgen Index: src/insets/InsetExternal.cpp === --- src/insets/InsetExternal.cpp (Revision 18821) +++ src/insets/InsetExternal.cpp (Arbeitskopie) @@ -577,8 +577,9 @@ return support::bformat((_(External template %1$s is not installed)), from_utf8(params.templatename())); // FIXME UNICODE + docstring gui = _(ptr-guiName); return from_utf8(external::doSubstitution(params, buffer, -ptr-guiName, false)); +to_utf8(gui), false)); } void add_preview_and_start_loading(RenderMonitoredPreview , Index: src/frontends/qt4/QExternal.cpp === --- src/frontends/qt4/QExternal.cpp (Revision 18821) +++ src/frontends/qt4/QExternal.cpp (Arbeitskopie) @@ -544,7 +544,7 @@ for (std::vectorstring::const_iterator cit = templates.begin(); cit != templates.end(); ++cit) { - dialog_-externalCO-addItem(toqstr(*cit)); + dialog_-externalCO-addItem(qt_(*cit)); } // Fill the origins combo @@ -604,7 +604,7 @@ { external::Template templ = controller().getTemplate(dialog_-externalCO-currentIndex()); - dialog_-externalTB-setPlainText(toqstr(templ.helpText)); + dialog_-externalTB-setPlainText(qt_(templ.helpText)); // Ascertain which (if any) transformations the template supports // and disable tabs hosting unsupported transforms. Index: po/Makefile.in.in === --- po/Makefile.in.in (Revision 18821) +++ po/Makefile.in.in (Arbeitskopie) @@ -376,7 +376,7 @@ sort | uniq ) [EMAIL PROTECTED] \ mv [EMAIL PROTECTED] $@ -l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot +l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot external_l10n.pot cat $^ | \ msguniq -o $(DOMAIN).po rm -f $^ @@ -399,6 +399,9 @@ i18n.php: $(POFILES) postats.sh (cd $(srcdir) ; ./postats.sh $(POFILES)) $@ +external_l10n.pot: $(top_srcdir)/lib/external_templates + python $(srcdir)/lyx_pot.py -b $(top_srcdir) -o $@ -t external ${top_srcdir}/lib/external_templates + force: # Tell versions [3.59,3.63) of GNU make not to export all variables. Index: po/lyx_pot.py === --- po/lyx_pot.py (Revision 18821) +++ po/lyx_pot.py (Arbeitskopie) @@ -145,6 +145,55 @@ output.close() +def external_l10n(input_files, output, base): +'''Generate pot file from lib/external_templates''' +output = open(output, 'w') +Template = re.compile(r'^Template\s+(.*)') +GuiName = re.compile(r'\s*GuiName\s+(.*)') +HelpTextStart = re.compile(r'\s*HelpText\s') +HelpTextSection = re.compile(r'\s*(\S.*)\s*$') +HelpTextEnd = re.compile(r'\s*HelpTextEnd\s') +i = -1 +for src in input_files: +input = open(src) +inHelp = False +hadHelp = False +prev_help_string = '' +for lineno, line in enumerate(input.readlines()): +if Template.match(line): +(string,) = Template.match(line).groups() +elif GuiName.match(line): +(string,) = GuiName.match(line).groups() +elif inHelp: +if HelpTextEnd.match(line): +if hadHelp: +print output, '\nmsgstr \n' +inHelp = False +hadHelp = False +prev_help_string = '' +elif HelpTextSection.match(line): +(help_string,) = HelpTextSection.match(line).groups() +help_string = help_string.replace('', '') +if help_string != and prev_help_string == '': +print output, '#: %s:%d\nmsgid \n%s\\n' % \ +(relativePath(src, base), lineno+1, help_string) +hadHelp = True +elif help_string != : +print output, '%s\\n' % help_string +prev_help_string = help_string +elif HelpTextStart.match(line): +inHelp = True +prev_help_string = '' +else: +continue +string = string.replace('', '') +if string != and not inHelp: +print output, '#: %s:%d\nmsgid %s\nmsgstr \n' % \ +(relativePath(src, base), lineno+1, string) +input.close() +output.close() + + Usage = ''' lyx_pot.py [-b|--base top_src_dir] [-o|--output output_file] [-h|--help] -t|--type input_type input_files @@ -158,6 +207,7 @@ layouts: lib/layouts/* qt4: qt4 ui files languages:
Re: [patch] fix broken listings ui
Jürgen Spitzmüller wrote: OK? Since it's obvious and harmless, I just committed. Jürgen
Re: RC2 coming soon
José Matos wrote: I will start looking to remaining issues before RC2, AFAIR there are two patches that I would like to have before the release, one by Jürgen that has a file format change and another related with reverting documents to 1.4. Yes. I keep on waiting for you to do the python part. Jürgen
Re: tex2lyx
Ekkehart == Ekkehart Schlicht [EMAIL PROTECTED] writes: Ekkehart I just imported a manuscript from a Latex file that has been Ekkehart produced from a Document file (.doc) by exporting from Ekkehart OpenOffice Writer 2.2. The tex file compiles well with Latex Ekkehart and the outpurt is the best from all doc2tex coverters I Ekkehart have tried. Ekkehart Lyx 1.4.4-4 imports, but the imported file cannot be viewed Ekkehart as PDF. Lots of complains: inmputenc error: keyboard Ekkehart character is undefined. I guess this can be mended. In most Ekkehart cases the complaint is just about some superfluous curly Ekkehart brackets. Ekkehart Lyx 1.50rc1 does not import at all. Ekkehart If somebody is interested, I can produce a minimal example Ekkehart next week. Hello, It would be interesting indeed to see a minimal file. JMarc
Re: [PATCH] do not replace deleted text
Michael == Michael Gerz [EMAIL PROTECTED] writes: Michael Hi, the following patch by Jürgen (with a minor fix by Michael myself) prevents the replacement of deleted text. Michael I tested the fix and it works. Is the thing correct when there is no selection? I would think the replace() then searches for the next hit. Of course, this is difficult to get right, but at least a FIXME would be useful. What happens when there is a multi paragraph selection? Does LyX just crash? JMarc
Re: XPM images --- a thought
Andre == Andre Poenitz [EMAIL PROTECTED] writes: Andre Because that is not needed either. We can just the frontend's Andre resource system and would not need to ship individual files at Andre all. I do not think this gains anything. Andre Slightly quicker loading of individual pixmaps at the price of Andre slightly larger startup times (with a total gain) and less Andre messy user side code. Compare Concerning icons: - from times to times, we have people contributing icons because it is so easy to do and they need it. Now only people with Qt tools will be able to do anything - what we want to do eventually is to rely as much as possible on standard icons with naming (tango?) defined by freedesktop.org. We will need to elaborate an icons loading procedure at this time (and I doubt it will be resource based, but I may be wrong). JMarc
Re: [PATCH] do not replace deleted text
Jean-Marc Lasgouttes wrote: Is the thing correct when there is no selection? I would think the replace() then searches for the next hit. Of course, this is difficult to get right, but at least a FIXME would be useful. I would think everythink would be OK if the replace and replace all buttons would be greyed out if disabled. Why should replace do nothing but search for the next hit? What happens when there is a multi paragraph selection? Does LyX just crash? No. It does nothing (as it should IMHO). Jürgen
Re: some feedback on installing lyx1.5rc1 on windows
On Mon, 18 Jun 2007, [EMAIL PROTECTED] wrote: I assume you're rather computer savvy. Would you say above average (for a Windows user)? Yes, I think I could say above average. I'm able to install windows and have already tried ubuntu, puppy linux and some others. I'm using texlive under ubuntu and last tried miktex 2.4 on win98. I find the tex package management in miktex awesome, which allows to just install a basic system and installs on the fly any needed package upon compiling the tex file. That's some long needed feature under linux. This obviously needs to be clarfied. Did you look at any kind of documentation or description of the installer before chosing the bundled version? If so, would you mind looking again and say if you think there's an obvious place to put this 'caveat'? (I could add such an information, but I'd like to add it in a place where the user actually looks... :-) I didn't. From the news entry on the website, I went straight to the ftp site (ftp://ftp.devel.lyx.org/pub/lyx/pre/) where the binaries are located. There are just 2 windows installers to pick from for 1.5rc1: LyX-1.5.0rc1-Installer-bundle.exe LyX-1.5.0rc1-Installer.exe I picked the bundle, as I wanted to have one big package to handle everything at once and I assumed that one would do the trick. As for a caveat, one could write a readme file write on the ftp-site explaining the files. I didn't landed on the wiki (http://wiki.lyx.org/Windows/Windows) by means of the download page (http://www.lyx.org/download/), though. Regarding the bundle, the wiki page states: This version includes all components and is intended to install LyX on multiple computers. Here one could be more explicit, explaining that aspell dictionaries and other miktex packages will still be (automatically) grabbed and installed from the internet during the installation. A few lines explaining why the alternative installer is different from the standard installer would be nice, too. The reason for why MikTeX wants/needs to go online should probably be added and explained. I don't know why, but others will probably tell us. I think now I know. I think that *the* basic miktex installation is installed with the standard installer. LyX doesn't need any extra packages to run (in my case, though, because of my choice of german and DINA4, it does need koma script to compile the documents), but LyX comes also with many templates for all sorts of documents (which is great!). For compiling the documents written in those templates some latex document class files are needed. Miktex knew this upon installation and tried to get them right away. For the record, every time I run LyX after a reboot miktex again asks for permission to download and install the missing packages. I also was wrong in my estimate: they are ~50. All the dictionary installers sum up to around 30-60 MB, so at worst it would almost double the size. That's a lot of MBs ;-). But still, from my point of view, it does make sense to provide an installer with everything on it, including spellchecking for the officially supported languages and sty-packages for the officially supported templates. Maybe you could not just include the basic miktex installer in your lyx installer, but a modified installer which already has the class packages that lyx will need? Uwe, does your complete installer contain dictionaries as well? If that's the case, Rafael might simply have been better off using that installer... Perhaps that's even the case with the MikTeX packages, I don't know. Rafael, did you look at the alternative installer? I didn't. See above. Why this is needed in order to just run lyx escapes my understanding. What's not obvious is that these aren't needed. I believe it's ok for MikTeX to fail to install these, and LyX will still run. Please correct me if this wasn't the case for you. LyX did run. See above. Thanks for answering. Best regards Rafael
Re: [PATCH] do not replace deleted text
Jürgen == Jürgen Spitzmüller [EMAIL PROTECTED] writes: Jürgen Jean-Marc Lasgouttes wrote: Is the thing correct when there is no selection? I would think the replace() then searches for the next hit. Of course, this is difficult to get right, but at least a FIXME would be useful. Jürgen I would think everythink would be OK if the replace and Jürgen replace all buttons would be greyed out if disabled. Why Jürgen should replace do nothing but search for the next hit? My reading of the replace() function in lyxfind.cpp seemed to imply this. But I may be wrong. In particular, it seems to me that stringSelected is eventually invoked and can do an extra search. What happens when there is a multi paragraph selection? Does LyX just crash? Jürgen No. It does nothing (as it should IMHO). + DocIterator beg = cur.selectionBegin(); + DocIterator end = cur.selectionEnd(); + bool enabled = true; + for (pos_type p = beg.pos() ; p end.pos() ; ++p) { + if (cur.paragraph().isDeleted(p)) + enabled = false; + } reading the code above, I would say that it crashes if selectionBegin and selectionEnd are not the same paragraph and the paragraphs have different number of characters. First, can you even tell me which paragraph is cur.paragraph()? I think a test should be added. JMarc
Re: Insets Data Structure
Dov Feldstern wrote: Yeah, I don't know. I'm just basing this on the comment above. But I can't imagine that there are anywhere near 32-bits worth of unicode symbols... The Unicode standard defines that it has 21-bit code points, so there are 11 bits left that can be used. This number will not be changed in the future, unless they create a completely new standard. Joost
RE: RE: RE: Re: Empty Math Panel Popups
another approach: here i use the old math panel (the one that works for everyone) and draw a tear-off widget ourselves works fine for me so am seeking volunteers (esp mac and linux)! any takers? ;-) Index: src/frontends/qt4/IconPalette.cpp === --- src/frontends/qt4/IconPalette.cpp (revision 18822) +++ src/frontends/qt4/IconPalette.cpp (working copy) @@ -25,99 +25,82 @@ #include QStyle #include QStyleOptionFrame #include QMouseEvent +#include QVBoxLayout namespace lyx { namespace frontend { -#if QT_VERSION = 0x040200 - - -class MathButton : public QToolButton +TearOff::TearOff(QWidget * parent) + : QWidget(parent) { -public: - MathButton(QWidget * parent = 0) {} - void mouseReleaseEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); -}; + highlighted_ = false; + //setMinimumHeight(QStyle::PM_MenuTearoffHeight); + setMinimumHeight(10); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); +} -void MathButton::mouseReleaseEvent(QMouseEvent *event) +void TearOff::mouseReleaseEvent ( QMouseEvent * event ) { - QToolButton::mouseReleaseEvent(event); - event-ignore(); + // signal + tearOff(); } -void MathButton::mousePressEvent(QMouseEvent *event) +void TearOff::enterEvent(QEvent * event) { - QToolButton::mousePressEvent(event); + highlighted_ = true; + update(); event-ignore(); } -IconPalette::IconPalette(QWidget * parent) - : QWidgetAction(parent), size_(QSize(22, 22)) +void TearOff::leaveEvent(QEvent * event) { + highlighted_ = false; + update(); + event-ignore(); } - -void IconPalette::addButton(QAction * action) +void TearOff::paintEvent(QPaintEvent * event) { - actions_.push_back(action); -} +QPainter p(this); +QRegion emptyArea = QRegion(rect()); - -QWidget * IconPalette::createWidget(QWidget * parent) -{ - QWidget * widget = new QWidget(parent); - QGridLayout * layout = new QGridLayout(widget); - layout-setSpacing(0); - - for (int i = 0; i actions_.size(); ++i) { - MathButton * tb = new MathButton(widget); - tb-setAutoRaise(true); - tb-setDefaultAction(actions_.at(i)); - tb-setIconSize(size_); - connect(this, SIGNAL(iconSizeChanged(const QSize )), - tb, SLOT(setIconSize(const QSize ))); - - int const row = i/qMin(6, i + 1) + 1; - int const col = qMax(1, i + 1 - (row - 1) * 6); - layout-addWidget(tb, row, col); - } - - return widget; +const int fw = style()-pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); +QStyleOptionMenuItem menuOpt; +menuOpt.initFrom(this); +menuOpt.palette = palette(); +menuOpt.state = QStyle::State_None; +menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; +menuOpt.menuRect = rect(); +menuOpt.maxIconWidth = 0; +menuOpt.tabWidth = 0; +menuOpt.menuItemType = QStyleOptionMenuItem::TearOff; +menuOpt.rect.setRect(fw, fw, width() - (fw * 2), + style()-pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); +emptyArea -= QRegion(menuOpt.rect); +p.setClipRect(menuOpt.rect); +menuOpt.state = QStyle::State_None; +if (highlighted_) +menuOpt.state |= QStyle::State_Selected; +style()-drawControl(QStyle::CE_MenuTearoff, menuOpt, p, this); } - -void IconPalette::setIconSize(const QSize size) -{ - size_ = size; - // signal - iconSizeChanged(size); -} - - -void IconPalette::updateParent() -{ - bool enable = false; - for (int i = 0; i actions_.size(); ++i) - if (actions_.at(i)-isEnabled()) { - enable = true; - break; - } - // signal - enabled(enable); -} - -#else // QT_VERSION = 0x040200 - IconPalette::IconPalette(QWidget * parent) : QWidget(parent, Qt::Popup) { - layout_ = new QGridLayout(this); + tornoff_ = false; + QVBoxLayout * v = new QVBoxLayout(this); + v-setMargin(0); + layout_ = new QGridLayout; layout_-setSpacing(0); - layout_-setMargin(3); + layout_-setMargin(2); + tearoffwidget_ = new TearOff(this); + connect(tearoffwidget_, SIGNAL(tearOff()), this, SLOT(tearOff())); + tearoffwidget_-setMaximumSize(QSize(16777215, 10)); + v-addWidget(tearoffwidget_); + v-addLayout(layout_); } @@ -141,10 +124,20 @@ } +void IconPalette::tearOff() +{ + setWindowFlags(Qt::Tool); + tornoff_ = true; + tearoffwidget_-setVisible(!tornoff_); + show(); +} + + void IconPalette::clicked(QAction * action) { triggered(action); - setVisible(false); + if (!tornoff_) + setVisible(false); } @@ -191,6 +184,9 @@ void IconPalette::hideEvent(QHideEvent * event ) { visible(false); + setWindowFlags(Qt::Popup); + tornoff_ = false; + tearoffwidget_-setVisible(!tornoff_); QWidget::hideEvent(event); } @@ -234,7 +230,6 @@ // draw the rest (buttons) QWidget::paintEvent(event); } -#endif // QT_VERSION = 0x040200 ButtonMenu::ButtonMenu(const QString title, QWidget * parent) Index: src/frontends/qt4/IconPalette.h === --- src/frontends/qt4/IconPalette.h (revision 18822) +++
Re: [patch] bug 3764: Implicit \author field in .lyx files
In contrary, my resources are limited at the moment. the quick fix is below. Setting the user name to anonymous may be a good solution for the time being (at least for 1.5rc2) provided that we can change back to the old settings at no cost later. afaik the current situation is : 1. user can change from anonymous anytime if he decide (and find it:) in preferences. 2. patched functions are used only when no ~/.lyx/preferences is found - so this patch does not change previously saved settings. likewise once anonymous is saved in preferences, just starting new release of lyx wont automaticaly change from anonymous, so in this sense it is not revertible unless user voluntarily change it. pavel Index: src/support/userinfo.cpp === --- src/support/userinfo.cpp(revision 18822) +++ src/support/userinfo.cpp(working copy) @@ -36,6 +36,11 @@ docstring const user_name() { + //FIXME: quick fix wrt bug 3764; only Anonymous is detected now. + //The code after should be used only after user approval. + return from_local8bit(Anonymous); + + #if defined (_WIN32) char name[UNLEN + 1]; @@ -57,6 +62,11 @@ docstring const user_email() { + //FIXME: quick fix wrt bug 3764; only Anonymous is detected now. + //The code after should be used only after user approval. + return docstring(); + + string email = getEnv(EMAIL_ADDRESS); if (email.empty()) email = getEnv(EMAIL);
Re: tex2lyx
Jean-Marc: I deposited an example to http://www.semverteilung.vwl.uni-muenchen.de/temp/short.zip It contains 1. short.doc: Shortened version of a winword file I obtained from the publisher 2. short.tex: short.doc exported by OpenOfficeWriter 2.2 to Latex. As you can see it is rather clean. It woulkd be good however, to have a way for replacing things that LyX don't understand, like {\selectlanguage{english} or {\textasciigrave} from *within* lyx, rather than in an external editor. 3. short.pdf: PDF file generated from the (totally unmodified) short.tex As you will see, LyX 1.5 can't open it. Lyx 1.4.4 can, but does not produce Latex output. (View does not work here, on the same Latex system where short.tex compiled without any problem! Strange.) Maybe this is a useful real world test case that may be used to tune tex2lyx. Needless to say, I can produce a tex file readable by lyx from short.tex by replacing the preamble and doing various substitutions by hand. (I actually did so.) But it would be even better if Lyx could deal with such stuff automatically. Cheers and thanks Ekkehart Ekkehart shortened version of the WinWird file Jean-Marc Lasgouttes wrote: Ekkehart == Ekkehart Schlicht [EMAIL PROTECTED] writes: Ekkehart I just imported a manuscript from a Latex file that has been Ekkehart produced from a Document file (.doc) by exporting from Ekkehart OpenOffice Writer 2.2. The tex file compiles well with Latex Ekkehart and the outpurt is the best from all doc2tex coverters I Ekkehart have tried. Ekkehart Lyx 1.4.4-4 imports, but the imported file cannot be viewed Ekkehart as PDF. Lots of complains: inmputenc error: keyboard Ekkehart character is undefined. I guess this can be mended. In most Ekkehart cases the complaint is just about some superfluous curly Ekkehart brackets. Ekkehart Lyx 1.50rc1 does not import at all. Ekkehart If somebody is interested, I can produce a minimal example Ekkehart next week. Hello, It would be interesting indeed to see a minimal file. JMarc
Re: [PATCH] do not replace deleted text
Jean-Marc Lasgouttes wrote: Is the thing correct when there is no selection? I would think the replace() then searches for the next hit. Of course, this is difficult to get right, but at least a FIXME would be useful. Jürgen I would think everythink would be OK if the replace and Jürgen replace all buttons would be greyed out if disabled. Why Jürgen should replace do nothing but search for the next hit? My reading of the replace() function in lyxfind.cpp seemed to imply this. But I may be wrong. No, you're right. I've missed this. The attached patch proposes a different approach that looks more consistent. In particular, it seems to me that stringSelected is eventually invoked and can do an extra search. ??? What happens when there is a multi paragraph selection? Does LyX just crash? Jürgen No. It does nothing (as it should IMHO). + DocIterator beg = cur.selectionBegin(); + DocIterator end = cur.selectionEnd(); + bool enabled = true; + for (pos_type p = beg.pos() ; p end.pos() ; ++p) { + if (cur.paragraph().isDeleted(p)) + enabled = false; + } reading the code above, I would say that it crashes if selectionBegin and selectionEnd are not the same paragraph and the paragraphs have different number of characters. First, can you even tell me which paragraph is cur.paragraph()? I think a test should be added. I see. Like in the attached? (I don't see the need to do the test for multiple paragraphs) JMarc Jürgen Index: src/BufferView.cpp === --- src/BufferView.cpp (Revision 18821) +++ src/BufferView.cpp (Arbeitskopie) @@ -693,6 +693,7 @@ case LFUN_NOTE_NEXT: case LFUN_REFERENCE_NEXT: case LFUN_WORD_FIND: + case LFUN_WORD_REPLACE: case LFUN_MARK_OFF: case LFUN_MARK_ON: case LFUN_MARK_TOGGLE: @@ -704,10 +705,6 @@ flag.enabled(true); break; - case LFUN_WORD_REPLACE: - flag.enabled(!cur.paragraph().isDeleted(cur.pos())); - break; - case LFUN_LABEL_GOTO: { flag.enabled(!cmd.argument().empty() || getInsetByCodeInsetRef(cur, Inset::REF_CODE)); @@ -953,9 +950,21 @@ find(this, cmd); break; - case LFUN_WORD_REPLACE: - replace(this, cmd); + case LFUN_WORD_REPLACE: { + bool has_deleted = false; + if (cur.selection()) { + DocIterator beg = cur.selectionBegin(); + DocIterator end = cur.selectionEnd(); + if (beg.pit() == end.pit()) { +for (pos_type p = beg.pos() ; p end.pos() ; ++p) { + if (cur.paragraph().isDeleted(p)) + has_deleted = true; +} + } + } + replace(this, cmd, has_deleted); break; + } case LFUN_MARK_OFF: cur.clearSelection(); Index: src/lyxfind.cpp === --- src/lyxfind.cpp (Revision 18821) +++ src/lyxfind.cpp (Arbeitskopie) @@ -298,7 +298,7 @@ } -void replace(BufferView * bv, FuncRequest const ev) +void replace(BufferView * bv, FuncRequest const ev, bool has_deleted) { if (!bv || ev.action != LFUN_WORD_REPLACE) return; @@ -319,23 +319,34 @@ Buffer * buf = bv-buffer(); - int const replace_count = all - ? replaceAll(bv, search, rplc, casesensitive, matchword) - : replace(bv, search, rplc, casesensitive, matchword, forward); - - if (replace_count == 0) { - // emit message signal. - buf-message(_(String not found!)); - } else { - if (replace_count == 1) { + if (!has_deleted) { + int const replace_count = all + ? replaceAll(bv, search, rplc, casesensitive, matchword) + : replace(bv, search, rplc, casesensitive, matchword, forward); + + if (replace_count == 0) { // emit message signal. - buf-message(_(String has been replaced.)); + buf-message(_(String not found!)); } else { - docstring str = convertdocstring(replace_count); - str += _( strings have been replaced.); + if (replace_count == 1) { +// emit message signal. +buf-message(_(String has been replaced.)); + } else { +docstring str = convertdocstring(replace_count); +str += _( strings have been replaced.); +// emit message signal. +buf-message(str); + } + } + } else { + // if we have deleted characters, we do not replace at all, but + // rather search for the next occurence + bool const found = find(bv, search, + casesensitive, matchword, forward); + + if (!found) // emit message signal. - buf-message(str); - } + bv-message(_(String not found!)); } } Index: src/lyxfind.h === --- src/lyxfind.h (Revision 18821) +++ src/lyxfind.h (Arbeitskopie) @@ -52,7 +52,7 @@ * \c ev.argument and act on it. * The string is encoded by \c replace2string. */ -void replace(BufferView * bv, FuncRequest const ); +void replace(BufferView * bv, FuncRequest const , bool has_deleted = false); /// find the next change in the buffer bool findNextChange(BufferView
RE: RE: RE: Re: Empty Math Panel Popups
Leuven, E. wrote: another approach: here i use the old math panel (the one that works for everyone) and draw a tear-off widget ourselves works fine for me so am seeking volunteers (esp mac and linux)! any takers? ;-) Works fine here (linux, qt 4.2.3). Nice stuff. A/
Re: Empty Math Panel Popups
On Jun 19, 2007, at 6:08 AM, Leuven, E. wrote: another approach: here i use the old math panel (the one that works for everyone) and draw a tear-off widget ourselves works fine for me so am seeking volunteers (esp mac and linux)! any takers? ;-) tearoff2.diff It works on Mac, though it's not obvious that it should. The panel that pops up has a wider border on the top with an extra horizontal line, but nothing that looks like a title bar. Clicking on that wide border switches from the pop-up panel to the tear-off panel, complete with title bar; this tear-off panel can then be relocated and resized (though resizing does not result in a rearrangement of the icons). Bennett
RE: RE: RE: RE: Re: Empty Math Panel Popups
From: news on behalf of Alfredo Braunstein Works fine here (linux, qt 4.2.3). Nice stuff. great. so if now some mac people can chime in...
RE: Empty Math Panel Popups
Bennett Helm wrote: It works on Mac, though it's not obvious that it should. don't know what this means The panel that pops up has a wider border on the top with an extra horizontal line, but nothing that looks like a title bar. sounds like intended behavior: this is the regular popup (click and it disappears) Clicking on that wide border switches from the pop-up panel to the tear-off panel, complete with title bar; you got it this tear-off panel can then be relocated and should stay on top (allow you to enter multiple symbols in a row) until you explicitly close it... and resized (though resizing does not result in a rearrangement of the icons). nope
Re: Empty Math Panel Popups
On Jun 19, 2007, at 9:13 AM, Leuven, E. wrote: Bennett Helm wrote: It works on Mac, though it's not obvious that it should. don't know what this means What I meant is that when the panel pops up, there's no clear indication from its appearance that tearing it off can work, and so people won't likely try clicking there and discover the tear-off feature. Is there some other way to make this function more apparent? The panel that pops up has a wider border on the top with an extra horizontal line, but nothing that looks like a title bar. sounds like intended behavior: this is the regular popup (click and it disappears) Clicking on that wide border switches from the pop-up panel to the tear-off panel, complete with title bar; you got it this tear-off panel can then be relocated and should stay on top (allow you to enter multiple symbols in a row) until you explicitly close it... and resized (though resizing does not result in a rearrangement of the icons). nope But then it should not be resizable. Bennett
Re: [patch] Mini-buffer popup does not close on enter or space, #3588
Anybody tried it? Need another OK for committing. Stefan Am 18.06.2007 um 11:37 schrieb Abdelrazak Younes: Stefan Schimanski wrote: Sorry, I misread Key_Space for Key_Escape. But Key_Space of course doesn't look right as an LFUN can have arguments. That's the reason for Key_Space. Space will also select the current item and you can continue typing arguments. Note that also Enter will not issue the command, but go back to the command edit line. Ah... OK. Then OK ;-) Abdel. PGP.sig Description: Signierter Teil der Nachricht
Re: Can't enter extra whitespace when editing.
Darren Freeman wrote: On Mon, 2007-06-18 at 12:40 +0200, Hellmut Weber wrote: Hi Darren, don't you think that calling a lyx behaviour 'gestapo behaviour' is inappropriate? I don't think I spent any more than three seconds on it and hadn't considered it to be anything other than a little colourful. I was referring to the heavy-handed policing which LyX is now applying to extra white-space and I think I made my point. Removing those spaces from the screen is on purpose. LyX could let them through, but they will be stripped away when printing anyway, so better let you see what you are going to get anyway. Helge Hafting
RE: Empty Math Panel Popups
Bennett Helm wrote: What I meant is that when the panel pops up, there's no clear indication from its appearance that tearing it off can work, and so people won't likely try clicking there and discover the tear-off feature. Is there some other way to make this function more apparent? i've added a tooltip but for the moment tooltips don't show in the panels i don't know why: when we tear off the panel (ie set windowflags to Qt:Tool) they *do* show so i am afraid that for the moment this is just the way it is (unless someone else comes up with the solution)... But then it should not be resizable. the attached patch does that ... in summary: - allow panels to tear off using only qt 4.1 functionality - reported to work on windows, linux and mac seeking 2 ok's Index: src/frontends/qt4/IconPalette.cpp === --- src/frontends/qt4/IconPalette.cpp (revision 18822) +++ src/frontends/qt4/IconPalette.cpp (working copy) @@ -25,99 +25,80 @@ #include QStyle #include QStyleOptionFrame #include QMouseEvent +#include QVBoxLayout namespace lyx { namespace frontend { -#if QT_VERSION = 0x040200 - - -class MathButton : public QToolButton +TearOff::TearOff(QWidget * parent) + : QWidget(parent) { -public: - MathButton(QWidget * parent = 0) {} - void mouseReleaseEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); -}; + highlighted_ = false; + setMinimumHeight(8); + setToolTip(qt_(Click to tear off)); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); +} -void MathButton::mouseReleaseEvent(QMouseEvent *event) +void TearOff::mouseReleaseEvent(QMouseEvent * event) { - QToolButton::mouseReleaseEvent(event); - event-ignore(); + // signal + tearOff(); } -void MathButton::mousePressEvent(QMouseEvent *event) +void TearOff::enterEvent(QEvent * event) { - QToolButton::mousePressEvent(event); + highlighted_ = true; + update(); event-ignore(); } -IconPalette::IconPalette(QWidget * parent) - : QWidgetAction(parent), size_(QSize(22, 22)) +void TearOff::leaveEvent(QEvent * event) { + highlighted_ = false; + update(); + event-ignore(); } -void IconPalette::addButton(QAction * action) +void TearOff::paintEvent(QPaintEvent * event) { - actions_.push_back(action); + QPainter p(this); + const int fw = style()-pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); + QStyleOptionMenuItem menuOpt; + menuOpt.initFrom(this); + menuOpt.palette = palette(); + menuOpt.state = QStyle::State_None; + menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; + menuOpt.menuRect = rect(); + menuOpt.maxIconWidth = 0; + menuOpt.tabWidth = 0; + menuOpt.menuItemType = QStyleOptionMenuItem::TearOff; + menuOpt.rect.setRect(fw, fw, width() - (fw * 2), + style()-pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); + p.setClipRect(menuOpt.rect); + menuOpt.state = QStyle::State_None; + if (highlighted_) + menuOpt.state |= QStyle::State_Selected; + style()-drawControl(QStyle::CE_MenuTearoff, menuOpt, p, this); } -QWidget * IconPalette::createWidget(QWidget * parent) -{ - QWidget * widget = new QWidget(parent); - QGridLayout * layout = new QGridLayout(widget); - layout-setSpacing(0); - - for (int i = 0; i actions_.size(); ++i) { - MathButton * tb = new MathButton(widget); - tb-setAutoRaise(true); - tb-setDefaultAction(actions_.at(i)); - tb-setIconSize(size_); - connect(this, SIGNAL(iconSizeChanged(const QSize )), - tb, SLOT(setIconSize(const QSize ))); - - int const row = i/qMin(6, i + 1) + 1; - int const col = qMax(1, i + 1 - (row - 1) * 6); - layout-addWidget(tb, row, col); - } - - return widget; -} - - -void IconPalette::setIconSize(const QSize size) -{ - size_ = size; - // signal - iconSizeChanged(size); -} - - -void IconPalette::updateParent() -{ - bool enable = false; - for (int i = 0; i actions_.size(); ++i) - if (actions_.at(i)-isEnabled()) { - enable = true; - break; - } - // signal - enabled(enable); -} - -#else // QT_VERSION = 0x040200 - IconPalette::IconPalette(QWidget * parent) - : QWidget(parent, Qt::Popup) + : QWidget(parent, Qt::Popup), tornoff_(false) { - layout_ = new QGridLayout(this); + QVBoxLayout * v = new QVBoxLayout(this); + v-setMargin(0); + v-setSpacing(0); + layout_ = new QGridLayout; layout_-setSpacing(0); - layout_-setMargin(3); + layout_-setMargin(2); + tearoffwidget_ = new TearOff(this); + connect(tearoffwidget_, SIGNAL(tearOff()), this, SLOT(tearOff())); + v-addWidget(tearoffwidget_); + v-addLayout(layout_); } @@ -141,15 +122,30 @@ } +void IconPalette::tearOff() +{ + blockSignals(true); + setWindowFlags(Qt::Tool); + tornoff_ = true; + tearoffwidget_-setVisible(!tornoff_); + show(); + blockSignals(false); +} + + void IconPalette::clicked(QAction * action) { triggered(action); - setVisible(false); + if (!tornoff_) + setVisible(false); } void IconPalette::showEvent(QShowEvent * event) { + resize(sizeHint()); + setMaximumSize(sizeHint()); + int
Re: Can't enter extra whitespace when editing.
On Tue, 2007-06-19 at 15:58 +0200, Helge Hafting wrote: Darren Freeman wrote: considered it to be anything other than a little colourful. I was referring to the heavy-handed policing which LyX is now applying to extra white-space and I think I made my point. Removing those spaces from the screen is on purpose. LyX could let them through, but they will be stripped away when printing anyway, so better let you see what you are going to get anyway. My point was that in the past you could enter them and they would be removed when you moved away, but now you can't enter them at all. I vote for the older behaviour which feels more natural. Have fun, Darren
[Updated PATCH] Child TOC Crash, Again
Abdelrazak Younes wrote: Richard Heck wrote: The attached patch builds on Abdel's earlier work and, I think, solves the remaining problems. Whether this is the best way to do it, I'm not sure. Abdel was talking about a more major re-organization of the code, but maybe that could wait. Maybe yes. What I've done is add an optional argument to LFUN_BUFFER_CHILD_OPEN indicating whether the file is being auto-loaded. (Contrary to what I said before, this is ok, since we're expecting a valid LyX filename, and one isn't going to end with |true.) There are also corresponding booleans in LyXView::loadLyXFile and BufferView::loadLyXFile. At this point BufferView::loadLyXFile() do not need to be a member of BufferView so please put that in buffer_func.cpp along the other loadLyXFile(). Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). I hope everything is OK with your daughter. Cheers, Abdel. Index: Buffer.cpp === --- Buffer.cpp (revision 18822) +++ Buffer.cpp (working copy) @@ -1616,7 +1616,11 @@ void Buffer::setParentName(string const name) { - params().parentname = name; + if (name == pimpl_-filename.absFilename()) + // Avoids recursive include. + params().parentname.clear(); + else + params().parentname = name; } Index: buffer_funcs.cpp === --- buffer_funcs.cpp(revision 18822) +++ buffer_funcs.cpp(working copy) @@ -180,6 +180,47 @@ return false; } +// FIXME: all of this should go in a helper file in buffer_func. +Buffer * checkAndLoadLyXFile(FileName const filename) +{ + // File already open? + if (theBufferList().exists(filename.absFilename())) { + docstring const file = makeDisplayPath(filename.absFilename(), 20); + docstring text = bformat(_(The document %1$s is already +loaded.\n\nDo you want to revert +to the saved version?), file); + if (Alert::prompt(_(Revert to saved document?), + text, 0, 1, _(Revert), _(Switch to document))) + return theBufferList().getBuffer(filename.absFilename()); + + // FIXME: should be LFUN_REVERT + if (theBufferList().close(theBufferList().getBuffer(filename.absFilename()), false)) + // Load it again. + return checkAndLoadLyXFile(filename); + else + // The file could not be closed. + return 0; + } + + if (isFileReadable(filename)) { + Buffer * b = theBufferList().newBuffer(filename.absFilename()); + if (!lyx::loadLyXFile(b, filename)) { + theBufferList().release(b); + return 0; + } + return b; + } + + docstring text = bformat(_(The document %1$s does not yet + exist.\n\nDo you want to create a new document?), + from_utf8(filename.absFilename())); + if (Alert::prompt(_(Create new document?), + text, 0, 1, _(Create), _(Cancel)) + return newFile(filename.absFilename(), string(), true); + + return 0; +} + // FIXME newFile() should probably be a member method of Application... Buffer * newFile(string const filename, string const templatename, bool const isNamed) Index: buffer_funcs.h === --- buffer_funcs.h (revision 18822) +++ buffer_funcs.h (working copy) @@ -34,6 +34,13 @@ */ bool loadLyXFile(Buffer *, support::FileName const filename); +/** + * Checks and loads a LyX file \param filename. + * \retval the newly created \c Buffer pointer if successful or 0. + * \retval 0 if the \c Buffer could not be created. + */ +Buffer * checkAndLoadLyXFile(support::FileName const filename); + /* Make a new file (buffer) with name \c filename based on a template * named \c templatename */ Index: BufferView.cpp === --- BufferView.cpp (revision 18822) +++ BufferView.cpp (working copy) @@ -233,78 +233,6 @@ graphics::Previews::get().generateBufferPreviews(*buffer_); } - -bool BufferView::loadLyXFile(FileName const filename, bool tolastfiles) -{ - // File already open? - if (theBufferList().exists(filename.absFilename())) { - docstring const file = makeDisplayPath(filename.absFilename(), 20); - docstring text = bformat(_(The document %1$s is already -loaded.\n\nDo you want to
[Updated PATCH 2] Child TOC Crash, Again
Abdelrazak Younes wrote: Abdelrazak Younes wrote: Richard Heck wrote: The attached patch builds on Abdel's earlier work and, I think, solves the remaining problems. Whether this is the best way to do it, I'm not sure. Abdel was talking about a more major re-organization of the code, but maybe that could wait. Maybe yes. What I've done is add an optional argument to LFUN_BUFFER_CHILD_OPEN indicating whether the file is being auto-loaded. (Contrary to what I said before, this is ok, since we're expecting a valid LyX filename, and one isn't going to end with |true.) There are also corresponding booleans in LyXView::loadLyXFile and BufferView::loadLyXFile. At this point BufferView::loadLyXFile() do not need to be a member of BufferView so please put that in buffer_func.cpp along the other loadLyXFile(). Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). Here is a patch that actually compiles and works for all use cases. Abdel. Index: Buffer.cpp === --- Buffer.cpp (revision 18822) +++ Buffer.cpp (working copy) @@ -1616,7 +1616,11 @@ void Buffer::setParentName(string const name) { - params().parentname = name; + if (name == pimpl_-filename.absFilename()) + // Avoids recursive include. + params().parentname.clear(); + else + params().parentname = name; } Index: buffer_funcs.cpp === --- buffer_funcs.cpp(revision 18822) +++ buffer_funcs.cpp(working copy) @@ -180,6 +180,47 @@ return false; } +// FIXME: all of this should go in a helper file in buffer_func. +Buffer * checkAndLoadLyXFile(FileName const filename) +{ + // File already open? + if (theBufferList().exists(filename.absFilename())) { + docstring const file = makeDisplayPath(filename.absFilename(), 20); + docstring text = bformat(_(The document %1$s is already +loaded.\n\nDo you want to revert +to the saved version?), file); + if (Alert::prompt(_(Revert to saved document?), + text, 0, 1, _(Revert), _(Switch to document))) + return theBufferList().getBuffer(filename.absFilename()); + + // FIXME: should be LFUN_REVERT + if (theBufferList().close(theBufferList().getBuffer(filename.absFilename()), false)) + // Load it again. + return checkAndLoadLyXFile(filename); + else + // The file could not be closed. + return 0; + } + + if (isFileReadable(filename)) { + Buffer * b = theBufferList().newBuffer(filename.absFilename()); + if (!lyx::loadLyXFile(b, filename)) { + theBufferList().release(b); + return 0; + } + return b; + } + + docstring text = bformat(_(The document %1$s does not yet + exist.\n\nDo you want to create a new document?), + from_utf8(filename.absFilename())); + if (Alert::prompt(_(Create new document?), + text, 0, 1, _(Create), _(Cancel))) + return newFile(filename.absFilename(), string(), true); + + return 0; +} + // FIXME newFile() should probably be a member method of Application... Buffer * newFile(string const filename, string const templatename, bool const isNamed) Index: buffer_funcs.h === --- buffer_funcs.h (revision 18822) +++ buffer_funcs.h (working copy) @@ -34,6 +34,13 @@ */ bool loadLyXFile(Buffer *, support::FileName const filename); +/** + * Checks and loads a LyX file \param filename. + * \retval the newly created \c Buffer pointer if successful or 0. + * \retval 0 if the \c Buffer could not be created. + */ +Buffer * checkAndLoadLyXFile(support::FileName const filename); + /* Make a new file (buffer) with name \c filename based on a template * named \c templatename */ Index: BufferView.cpp === --- BufferView.cpp (revision 18822) +++ BufferView.cpp (working copy) @@ -233,78 +233,6 @@ graphics::Previews::get().generateBufferPreviews(*buffer_); } - -bool BufferView::loadLyXFile(FileName const filename, bool tolastfiles) -{ - // File already open? - if (theBufferList().exists(filename.absFilename())) { - docstring const file = makeDisplayPath(filename.absFilename(), 20); - docstring text = bformat(_(The document %1$s is already -
Re: [Updated PATCH 2] Child TOC Crash, Again
Abdelrazak Younes wrote: Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). Here is a patch that actually compiles and works for all use cases. Whoops. I just committed the other one, per your suggestion. If you want to revert and commit this one, that's fine with me. I forgot to say in the log note that this was mostly your work, too. Richard Index: Buffer.cpp === --- Buffer.cpp (revision 18822) +++ Buffer.cpp (working copy) @@ -1616,7 +1616,11 @@ void Buffer::setParentName(string const name) { - params().parentname = name; + if (name == pimpl_-filename.absFilename()) + // Avoids recursive include. + params().parentname.clear(); + else + params().parentname = name; } Index: buffer_funcs.cpp === --- buffer_funcs.cpp(revision 18822) +++ buffer_funcs.cpp(working copy) @@ -180,6 +180,47 @@ return false; } +// FIXME: all of this should go in a helper file in buffer_func. +Buffer * checkAndLoadLyXFile(FileName const filename) +{ + // File already open? + if (theBufferList().exists(filename.absFilename())) { + docstring const file = makeDisplayPath(filename.absFilename(), 20); + docstring text = bformat(_(The document %1$s is already +loaded.\n\nDo you want to revert +to the saved version?), file); + if (Alert::prompt(_(Revert to saved document?), + text, 0, 1, _(Revert), _(Switch to document))) + return theBufferList().getBuffer(filename.absFilename()); + + // FIXME: should be LFUN_REVERT + if (theBufferList().close(theBufferList().getBuffer(filename.absFilename()), false)) + // Load it again. + return checkAndLoadLyXFile(filename); + else + // The file could not be closed. + return 0; + } + + if (isFileReadable(filename)) { + Buffer * b = theBufferList().newBuffer(filename.absFilename()); + if (!lyx::loadLyXFile(b, filename)) { + theBufferList().release(b); + return 0; + } + return b; + } + + docstring text = bformat(_(The document %1$s does not yet + exist.\n\nDo you want to create a new document?), + from_utf8(filename.absFilename())); + if (Alert::prompt(_(Create new document?), + text, 0, 1, _(Create), _(Cancel))) + return newFile(filename.absFilename(), string(), true); + + return 0; +} + // FIXME newFile() should probably be a member method of Application... Buffer * newFile(string const filename, string const templatename, bool const isNamed) Index: buffer_funcs.h === --- buffer_funcs.h (revision 18822) +++ buffer_funcs.h (working copy) @@ -34,6 +34,13 @@ */ bool loadLyXFile(Buffer *, support::FileName const filename); +/** + * Checks and loads a LyX file \param filename. + * \retval the newly created \c Buffer pointer if successful or 0. + * \retval 0 if the \c Buffer could not be created. + */ +Buffer * checkAndLoadLyXFile(support::FileName const filename); + /* Make a new file (buffer) with name \c filename based on a template * named \c templatename */ Index: BufferView.cpp === --- BufferView.cpp (revision 18822) +++ BufferView.cpp (working copy) @@ -233,78 +233,6 @@ graphics::Previews::get().generateBufferPreviews(*buffer_); } - -bool BufferView::loadLyXFile(FileName const filename, bool tolastfiles) -{ - // File already open? - if (theBufferList().exists(filename.absFilename())) { - docstring const file = makeDisplayPath(filename.absFilename(), 20); - docstring text = bformat(_(The document %1$s is already -loaded.\n\nDo you want to revert -to the saved version?), file); - int const ret = Alert::prompt(_(Revert to saved document?), - text, 0, 1, _(Revert), _(Switch to document)); - - if (ret != 0) { - setBuffer(theBufferList().getBuffer(filename.absFilename())); - return true; - } - // FIXME: should be LFUN_REVERT - if
Re: [patch] fix broken listings ui
On 6/19/07, Jürgen Spitzmüller [EMAIL PROTECTED] wrote: Jürgen Spitzmüller wrote: OK? Since it's obvious and harmless, I just committed. +1, though late. Bo
Re: [Updated PATCH 2] Child TOC Crash, Again
Richard Heck wrote: Abdelrazak Younes wrote: Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). Here is a patch that actually compiles and works for all use cases. Whoops. I just committed the other one, per your suggestion. If you want to revert and commit this one, that's fine with me. I fixed some other issues in my updated patch WRT the error list, the unneeded dialog updates and a few other things that I don't recall... So, I think I will do that... unless you prefer that I update my patch to current SVN (or you do it ;-). I forgot to say in the log note that this was mostly your work, too. No problem. Abdel.
Re: Can't enter extra whitespace when editing.
Darren == Darren Freeman [EMAIL PROTECTED] writes: Darren My point was that in the past you could enter them and they Darren would be removed when you moved away, but now you can't enter Darren them at all. I vote for the older behaviour which feels more Darren natural. Are you sure? What version was that? I doubt that it has changed recently. JMarc
Re: r18826 - /lyx-devel/trunk/src/BufferView.cpp
[EMAIL PROTECTED] wrote: Author: rgheck Date: Tue Jun 19 16:59:34 2007 New Revision: 18826 URL: http://www.lyx.org/trac/changeset/18826 Log: Trivial whitespace fix. Sorry but it doesn't look trivial... Modified: lyx-devel/trunk/src/BufferView.cpp Modified: lyx-devel/trunk/src/BufferView.cpp URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/BufferView.cpp?rev=18826 == --- lyx-devel/trunk/src/BufferView.cpp (original) +++ lyx-devel/trunk/src/BufferView.cpp Tue Jun 19 16:59:34 2007 @@ -209,26 +209,26 @@ if (!buffer_) return; - LYXERR(Debug::INFO) BOOST_CURRENT_FUNCTION -Buffer addr: buffer_ endl; - cursor_.push(buffer_-inset()); + LYXERR(Debug::INFO) BOOST_CURRENT_FUNCTION +Buffer addr: buffer_ endl; + cursor_.push(buffer_-inset()); + cursor_.resetAnchor(); + buffer_-text().setCurrentFont(cursor_); + if (buffer_-getCursor().size() 0 + buffer_-getAnchor().size() 0) + { + cursor_.setCursor(buffer_-getAnchor().asDocIterator((buffer_-inset(; cursor_.resetAnchor(); - buffer_-text().setCurrentFont(cursor_); - if (buffer_-getCursor().size() 0 - buffer_-getAnchor().size() 0) - { - cursor_.setCursor(buffer_-getAnchor().asDocIterator((buffer_-inset(; - cursor_.resetAnchor(); - cursor_.setCursor(buffer_-getCursor().asDocIterator((buffer_-inset(; - cursor_.setSelection(); - // do not set selection to the new buffer because we - // only paste recent selection. - - // Make sure that the restored cursor is not broken. This can happen for - // example if this Buffer has been modified by another view. - cursor_.fixIfBroken(); - } - updateMetrics(false); + cursor_.setCursor(buffer_-getCursor().asDocIterator((buffer_-inset(; + cursor_.setSelection(); + // do not set selection to the new buffer because we + // only paste recent selection. + + // Make sure that the restored cursor is not broken. This can happen for + // example if this Buffer has been modified by another view. + cursor_.fixIfBroken(); + } + updateMetrics(false); if (graphics::Previews::status() != LyXRC::PREVIEW_OFF) graphics::Previews::get().generateBufferPreviews(*buffer_); }
Re: [PATCH] do not replace deleted text
Jürgen == Jürgen Spitzmüller [EMAIL PROTECTED] writes: Jürgen I see. Like in the attached? (I don't see the need to do the Jürgen test for multiple paragraphs) It looks better, but I'll let Michael decide. JMarc
Re: r18826 - /lyx-devel/trunk/src/BufferView.cpp
Abdelrazak Younes wrote: [EMAIL PROTECTED] wrote: Author: rgheck Date: Tue Jun 19 16:59:34 2007 New Revision: 18826 URL: http://www.lyx.org/trac/changeset/18826 Log: Trivial whitespace fix. Sorry but it doesn't look trivial... OK, got it. Abdel.
Re: Empty Math Panel Popups
On Tue, Jun 19, 2007 at 04:14:18PM +0200, Leuven, E. wrote: in summary: - allow panels to tear off using only qt 4.1 functionality - reported to work on windows, linux and mac seeking 2 ok's Edwin, I really appreciate your effort for trying to provide this feature with Qt 4.1. However, I think that we should not jump through hoops if something is hard to obtain with older Qt versions. It suffices to let the thing compile, even with reduced functionality. I tried the patch with Qt 4.1 and it almost works (I am really impressed). There's a quirk, though. After detaching a panel and trying to close it again, LyX freezes. There's no cpu load, LyX simply doesn't respond anymore and after a Ctrl-C an emergency file is created. Taking into account the time and effort you put in this, I am really afraid to suggest leaving things as they are now and simply applying that small patch curing the moc problem. What do you (and others) think? -- Enrico
[Patch] Bugfix: last Buffer position is not remembered on buffer switch
Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. The fix is simple. The removed code is already done on Buffer deletion thanks to the Buffer::closing() signal connection to LyXView. Setting the Buffer twice was the reason of the bug. OK? Abdel. Index: LyXFunc.cpp === --- LyXFunc.cpp (revision 18827) +++ LyXFunc.cpp (working copy) @@ -2089,16 +2089,8 @@ // goto bookmark to update bookmark pit. for (size_t i = 0; i LyX::ref().session().bookmarks().size(); ++i) gotoBookmark(i+1, false, false); - if (theBufferList().close(lyx_view_-buffer(), true) !quitting) { - if (theBufferList().empty()) { - // need this otherwise SEGV may occur while - // trying to set variables that don't exist - // since there's no current buffer - lyx_view_-getDialogs().hideBufferDependent(); - } else { - lyx_view_-setBuffer(theBufferList().first()); - } - } + + theBufferList().close(lyx_view_-buffer(), true); }
Re: Bromarv
christian == christian ridderstrom [EMAIL PROTECTED] writes: christian On Mon, 18 Jun 2007, Andre Poenitz wrote: Now that I was too stupid to get my booking right the first time, I again have a choice of dates. Originally I was thinking about Thursday-Monday as usual but given the timetables that'd mean absolutely no work on Thursday and Monday, which is a bit below business as usual. So I think about taking the return flight on Tuesday - which, otoh, would not be _that_ nice if I were the only one hanging around in the waters of Finland ;-} So: When do other people come? christian I'm flexible and I'd enjoy doing something on Tuesday. I christian might stay around another day as well for that matter. So christian far I haven't decided if I'll fly there, or go by ferry and christian motorcycle/car. Looking at the timetables, only Finnair gives me an arrival date of 11h40 on Thursday (which is OK to catch the bus), but the return would have to be on monday (12h15) or wednesday. Last week there were many other flights, and with more interesting rates :( But in principle I would like to stay until tuesday. JMarc
Re: [PATCH] do not replace deleted text
Jean-Marc Lasgouttes wrote: It looks better, but I'll let Michael decide. OK. Michael, if you're fine with this as well, just commit it. Jürgen
Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Abdelrazak Younes wrote: Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 I've no time to test ATM, but your explanation makes sense. Jürgen
Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 No this is something else (that really needs to be fixed IMHO). This bug is on Buffer _close_. I've no time to test ATM, but your explanation makes sense. And it is really straight forward. Another OK someone? Abdel.
[PATCH] Fix bug 3171 (was Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 Actually the fix for bug 3171 is in Buffer::setBuffer(). But the fix to the bug above is needed for bug 3171 too. OK, who said OK? Abdel. Index: BufferView.cpp === --- BufferView.cpp (revision 18828) +++ BufferView.cpp (working copy) @@ -209,11 +209,14 @@ if (!buffer_) return; + updateMetrics(false); + LYXERR(Debug::INFO) BOOST_CURRENT_FUNCTION Buffer addr: buffer_ endl; cursor_.push(buffer_-inset()); cursor_.resetAnchor(); buffer_-text().setCurrentFont(cursor_); + if (buffer_-getCursor().size() 0 buffer_-getAnchor().size() 0) { @@ -227,12 +230,15 @@ // Make sure that the restored cursor is not broken. This can happen for // example if this Buffer has been modified by another view. cursor_.fixIfBroken(); + if (fitCursor()) + updateMetrics(false); } - updateMetrics(false); + if (graphics::Previews::status() != LyXRC::PREVIEW_OFF) graphics::Previews::get().generateBufferPreviews(*buffer_); } + void BufferView::resize() { if (!buffer_) Index: LyXFunc.cpp === --- LyXFunc.cpp (revision 18827) +++ LyXFunc.cpp (working copy) @@ -2089,16 +2089,8 @@ // goto bookmark to update bookmark pit. for (size_t i = 0; i LyX::ref().session().bookmarks().size(); ++i) gotoBookmark(i+1, false, false); - if (theBufferList().close(lyx_view_-buffer(), true) !quitting) { - if (theBufferList().empty()) { - // need this otherwise SEGV may occur while - // trying to set variables that don't exist - // since there's no current buffer - lyx_view_-getDialogs().hideBufferDependent(); - } else { - lyx_view_-setBuffer(theBufferList().first()); - } - } + + theBufferList().close(lyx_view_-buffer(), true); }
Re: [PATCH] Fix bug 3171 (was Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Abdelrazak Younes wrote: Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 Actually the fix for bug 3171 is in Buffer::setBuffer(). But the fix to the bug above is needed for bug 3171 too. OK, who said OK? Sorry, I couldn't wait cause I'll be off for a few days and I didn't want RC2 to behave like this. The fix is simple anyway and could be reverted easily if you think I was too fast. Abdel.
Re: [PATCH] Fix bug 3171 (was Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Abdelrazak Younes wrote: I'll be off for a few days and I didn't want RC2 to behave like this. Me as well (until the weekend). So if you think any of the patches I posted should go in, feel free to commit them. Jürgen
Re: Empty Math Panel Popups
Enrico Forestieri wrote: Edwin, I really appreciate your effort for trying to provide this feature with Qt 4.1. However, I think that we should not jump through hoops if something is hard to obtain with older Qt versions. It suffices to let the thing compile, even with reduced functionality. I tried the patch with Qt 4.1 and it almost works (I am really impressed). There's a quirk, though. After detaching a panel and trying to close it again, LyX freezes. There's no cpu load, LyX simply doesn't respond anymore and after a Ctrl-C an emergency file is created. i admit i was using qt 4.2 i now compiled with 4.1 and it turns out we cannot change windowflags on visible windows hiding the widget before changing the windowflags solves the problem for me could you try the attached? Taking into account the time and effort you put in this, I am really afraid to suggest leaving things as they are now and simply applying that small patch curing the moc problem. What do you (and others) think? the attached patch has the advantage that it also allows tearoff panels on the mac i would be very surprised if this one doesn't work for you Index: src/frontends/qt4/IconPalette.cpp === --- src/frontends/qt4/IconPalette.cpp (revision 18822) +++ src/frontends/qt4/IconPalette.cpp (working copy) @@ -25,99 +25,81 @@ #include QStyle #include QStyleOptionFrame #include QMouseEvent +#include QVBoxLayout namespace lyx { namespace frontend { -#if QT_VERSION = 0x040200 - - -class MathButton : public QToolButton +TearOff::TearOff(QWidget * parent) + : QWidget(parent) { -public: - MathButton(QWidget * parent = 0) {} - void mouseReleaseEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); -}; + highlighted_ = false; + setMinimumHeight(8); + setToolTip(qt_(Click to tear off)); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); +} -void MathButton::mouseReleaseEvent(QMouseEvent *event) +void TearOff::mouseReleaseEvent(QMouseEvent * event) { - QToolButton::mouseReleaseEvent(event); - event-ignore(); + // signal + tearOff(); } -void MathButton::mousePressEvent(QMouseEvent *event) +void TearOff::enterEvent(QEvent * event) { - QToolButton::mousePressEvent(event); + highlighted_ = true; + update(); event-ignore(); } -IconPalette::IconPalette(QWidget * parent) - : QWidgetAction(parent), size_(QSize(22, 22)) +void TearOff::leaveEvent(QEvent * event) { + highlighted_ = false; + update(); + event-ignore(); } -void IconPalette::addButton(QAction * action) +void TearOff::paintEvent(QPaintEvent * event) { - actions_.push_back(action); + QPainter p(this); + const int fw = style()-pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); + QStyleOptionMenuItem menuOpt; + menuOpt.initFrom(this); + menuOpt.palette = palette(); + menuOpt.state = QStyle::State_None; + menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; + menuOpt.menuRect = rect(); + menuOpt.maxIconWidth = 0; + menuOpt.tabWidth = 0; + menuOpt.menuItemType = QStyleOptionMenuItem::TearOff; + menuOpt.rect.setRect(fw, fw, width() - (fw * 2), + style()-pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); + p.setClipRect(menuOpt.rect); + menuOpt.state = QStyle::State_None; + if (highlighted_) + menuOpt.state |= QStyle::State_Selected; + style()-drawControl(QStyle::CE_MenuTearoff, menuOpt, p, this); } -QWidget * IconPalette::createWidget(QWidget * parent) -{ - QWidget * widget = new QWidget(parent); - QGridLayout * layout = new QGridLayout(widget); - layout-setSpacing(0); - - for (int i = 0; i actions_.size(); ++i) { - MathButton * tb = new MathButton(widget); - tb-setAutoRaise(true); - tb-setDefaultAction(actions_.at(i)); - tb-setIconSize(size_); - connect(this, SIGNAL(iconSizeChanged(const QSize )), - tb, SLOT(setIconSize(const QSize ))); - - int const row = i/qMin(6, i + 1) + 1; - int const col = qMax(1, i + 1 - (row - 1) * 6); - layout-addWidget(tb, row, col); - } - - return widget; -} - - -void IconPalette::setIconSize(const QSize size) -{ - size_ = size; - // signal - iconSizeChanged(size); -} - - -void IconPalette::updateParent() -{ - bool enable = false; - for (int i = 0; i actions_.size(); ++i) - if (actions_.at(i)-isEnabled()) { - enable = true; - break; - } - // signal - enabled(enable); -} - -#else // QT_VERSION = 0x040200 - IconPalette::IconPalette(QWidget * parent) - : QWidget(parent, Qt::Popup) + : QWidget(parent, Qt::Popup), tornoff_(false) { - layout_ = new QGridLayout(this); + QVBoxLayout * v = new QVBoxLayout(this); + v-setMargin(0); + v-setSpacing(0); + layout_ = new QGridLayout; layout_-setSpacing(0); - layout_-setMargin(3); + const int fw = style()-pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); + layout_-setMargin(fw); + tearoffwidget_ = new TearOff(this); + connect(tearoffwidget_, SIGNAL(tearOff()), this, SLOT(tearOff())); + v-addWidget(tearoffwidget_); + v-addLayout(layout_); } @@ -141,15 +123,31
Re: Empty Math Panel Popups
in summary: - allow panels to tear off using only qt 4.1 functionality - reported to work on windows, linux and mac seeking 2 ok's tearoff2.diff works for me with latest svn, qt4.3.0 and mac os x. andi
Fwd: r18833 - in /lyx-devel/trunk/development/Win32/packaging/...
To fix bug 3813, I have copied dictionary files to http://www.lyx.org/~bpeng/aspell6-windows; and make it an alternative downloading URL. The installer seems to work now. If there is a better location, I can change this URL. Cheers, Bo -- Forwarded message -- Author: bpeng Date: Tue Jun 19 21:29:36 2007 New Revision: 18833 URL: http://www.lyx.org/trac/changeset/18833 Log: Add an alternative aspell dict repository, fix bug 3813 Modified: lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh Modified: lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh URL: http://www.lyx.org/trac/file/lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh?rev=18833 == --- lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh (original) +++ lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh Tue Jun 19 21:29:36 2007 @@ -109,7 +109,13 @@ Pop $R3 ${if} $R3 != OK - #Download failed + #Download failed, try an alternative link + InetLoad::load ${ALT_DOWNLOAD_ASPELLDICTS}/aspell6-$R0.exe $PLUGINSDIR\aspell6-$R0.exe /END + Pop $R3 +${endif} + +${if} $R3 != OK + #Download failed again MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_DOWNLOAD_FAILED_DICT) ($R3) IDYES dict_download Goto dict_noinstall ${endif} Modified: lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh URL: http://www.lyx.org/trac/file/lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh?rev=18833 == --- lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh (original) +++ lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh Tue Jun 19 21:29:36 2007 @@ -35,6 +35,7 @@ !define DOWNLOAD_VIEWER http://tug.ctan.org/tex-archive/nonfree/support/ghostscript/ghostgum/gsv48w32.exe; !define DOWNLOAD_ASPELLDICTS ftp://ftp.lyx.org/pub/lyx/contrib/aspell6-windows; +!define ALT_DOWNLOAD_ASPELLDICTS http://www.lyx.org/~bpeng/aspell6-windows; # #Download size (in KB)
Re: [patch] bug 3764: Implicit \author field in .lyx files
Pavel Sanda schrieb: In contrary, my resources are limited at the moment. the quick fix is below. I think this is a good work-around for the time being (i.e. 1.5rc2). If I get another OK, I will commit. As soon as we have a better solution, I am going to revert the quick fix. Michael
Re: Empty Math Panel Popups
On Tue, Jun 19, 2007 at 08:40:52PM +0200, Edwin Leuven wrote: the attached patch has the advantage that it also allows tearoff panels on the mac i would be very surprised if this one doesn't work for you You did it! Works like a charm. A big thank you! -- Enrico
Re: Empty Math Panel Popups
Enrico Forestieri wrote: You did it! Works like a charm. :) A big thank you! thanks for testing! ... will collect 2 ok's tomorrow. josé?
Re: [patch] bug 3764: Implicit \author field in .lyx files
On Tuesday 19 June 2007 21:58:16 Michael Gerz wrote: If I get another OK, I will commit. As soon as we have a better solution, I am going to revert the quick fix. Michael OK. -- José Abílio
problems to show figures in LyX
Hi developers: I am running LyX 1.5.0rc1 on Windows XP SP2. When I include an eps graph, LyX is not able to show it but displays the message Error converting to loadable format I run lyxc.exe -dbg graphics and got the output below when including the graph. Does anybody knows what is going on? Thanks, Fernando Token: '\end_inset' [readBB_from_PSFile] no(e)ps-format [controller().bb_Changed set to true] [controller().bb_Changed set to true] [controller().bb_Changed set to true] [controller().bb_Changed set to true] [readBB_from_PSFile] no(e)ps-format Token: 'filename' Token: '\end_inset' LoaderQueue: waking up Recognised Fileformat: eps Recognised Fileformat: eps [readBB_from_PSFile] 39 24 480 523 [controller().bb_Changed set to true] [controller().bb_Changed set to true] [controller().bb_Changed set to true] [controller().bb_Changed set to true] Recognised Fileformat: eps Recognised Fileformat: eps [readBB_from_PSFile] 39 24 480 523 LoaderQueue: 1 items in the queue Recognised Fileformat: eps [graphics::CacheItem::Impl::convertToDisplayFormat] Attempting to convert image file: C:/TEST/figure1.ps with displayed filename: C:\TEST\figure1.ps Recognised Fileformat: eps The file contains eps format data. The image loader can load the following directly: bmp, pbm, pgm, png, ppm, xbm, xpm, Of these, LyX recognises the following formats: bmp, pbm, pgm, png, ppm, xbm, xpm Unable to convert from eps to bmp Unable to convert from eps to pbm Unable to convert from eps to pgm Converting it to png format. Error returned from iconv EILSEQ An invalid multibyte sequence has been encountered in the input. When converting from UTF-8 to UCS-4LE. Input: 0x43 0x3a 0x2f 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 0x73 0x20 0x61 0x6e 0x64 0x20 0x53 0x65 0x74 0x74 0x69 0x6e 0x67 0x73 0x2f 0x66 0x72 0x6f 0x69 0x67 0x2f 0x43 0x6f 0x6e 0x66 0x69 0x67 0x75 0x72 0x61 0xe7 0xf5 0x65 0x73 0x20 0x6c 0x6f 0x63 0x61 0x69 0x73 0x2f 0x54 0x65 0x6d 0x70 0x2f 0x6c 0x79 0x78 0x5f 0x74 0x6d 0x70 0x64 0x69 0x72 0x33 0x30 0x36 0x30 0x61 0x30 0x33 0x30 0x36 0x34 Converter c-tor: from_file: C:/TEST/figure1.ps to_file_base: C:/Documents and Settings/froig/Configuracoes locais/Temp/lyx_tmpdir3060a03064/CacheItem3060a03064 from_format: eps to_format:png build_script ... Error returned from iconv EILSEQ An invalid multibyte sequence has been encountered in the input. When converting from UTF-8 to UCS-4LE. Input: 0x43 0x3a 0x2f 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 0x73 0x20 0x61 0x6e 0x64 0x20 0x53 0x65 0x74 0x74 0x69 0x6e 0x67 0x73 0x2f 0x66 0x72 0x6f 0x69 0x67 0x2f 0x43 0x6f 0x6e 0x66 0x69 0x67 0x75 0x72 0x61 0xe7 0xf5 0x65 0x73 0x20 0x6c 0x6f 0x63 0x61 0x69 0x73 0x2f 0x54 0x65 0x6d 0x70 0x2f 0x6c 0x79 0x78 0x5f 0x74 0x6d 0x70 0x64 0x69 0x72 0x33 0x30 0x36 0x30 0x61 0x30 0x33 0x30 0x36 0x34 ready! Conversion script: -- #!/usr/bin/env python # -*- coding: utf-8 -*- import os, shutil, sys, locale def unlinkNoThrow(file): ''' remove a file, do not throw if an error occurs ''' try: os.unlink(file) except: pass def utf8ToDefaultEncoding(file): ''' if possible, convert to the default encoding ''' try: language, output_encoding = locale.getdefaultlocale() if output_encoding == None: output_encoding = 'latin1' return unicode(file, 'utf8').encode(output_encoding) except: return file infile = utf8ToDefaultEncoding(C:/TEST/figure1.ps) outfile = C:/Documents and Settings/froig/Configuracoes locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064.ps shutil.copy(infile, outfile) os.chdir(C:/Documents and Settings/froig/Configuracoes locais/Temp/lyx_tmpdir3060a03064/) infile = C:/Documents and Settings/froig/Configuracoes locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064.ps infile_base = C:/Documents and Settings/froig/Configuracoes locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064 outfile = C:/Documents and Settings/froig/Configuracoes locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064.png if os.system(r'convert eps:' + '' + infile + '' + ' png:' + '' + outfile + ' ' + '') != 0: unlinkNoThrow(outfile) sys.exit(1) if not os.path.isfile(outfile): if os.path.isfile(outfile + '.0'): os.rename(outfile + '.0', outfile) import glob for file in glob.glob(outfile + '.?'): unlinkNoThrow(file) else: sys.exit(1) unlinkNoThrow(infile) fromfile = outfile tofile = C:/Documents and Settings/froig/Configuracoes locais/Temp/lyx_tmpdir3060a03064/CacheItem3060a03064.png try: os.rename(fromfile, tofile) except: try: shutil.copy(fromfile, tofile) except: sys.exit(1) unlinkNoThrow(fromfile) -- ForkedCallQueue: waking up LoaderQueue: I'm going to sleep Traceback (most recent call last): File C:/Documents and Settings/froig/Configuracoes
Re: problems to show figures in LyX
I am running LyX 1.5.0rc1 on Windows XP SP2. When I include an eps graph, LyX is not able to show it but displays the message Error converting to loadable format I run lyxc.exe -dbg graphics and got the output below when including the graph. Does anybody knows what is going on? can be downloaded somewhere the lyx file+the picture(s) ? pavel
Re: Arabi / ArabTeX for Arabic
Dov Feldstern schrieb: * Numbers in Arabic are printed backwards (1234 - 4321), which is wrong. It#s up to you to change this. The arabi documentation tells you that you can put this also to a \textL environment. I'm attaching a patch for the \R - \AR issue, so that you can play around with it. But it shouldn't be applied, as it breaks ArabTeX! OK, now I was able to figure out why I get the problematic: I installed ArabTeX AND arabi. arabi uses the babel interface and therefore it is used for Arabic whenever it is installed, no special preamble call is needed. Therefore the \R command doesn't work, it only works when I load the arabTeX-package manually in the preamble: \usepackage{arabtex}. So one fix would be to add this preamble line automatically when the users uses Arabic as document language. I did the same with the armtex package when I implemented Armenian. But arabi is nevertherless required to provide the cp1256 input encoding that is needed on Windows for Arabic. Actually, Mostafa has fixed the last *two* issues for Farsi, but not for Arabic, so as not to interfere with ArabTex. But at least the know-how is already in the sources. We only need to figure out how to allow the option of either Arabi or ArabTeX, so that one doesn't break the other. I think Mostafa had an interesting idea for this, of defining two Arabic languages. This doesn't work. One version has to call ArabTeX in the preamble but arabi wil be used when it is installed due to its babel support except of the \R command. This leads to inconsistent output. And ArabTeX doesn't come with an input encoding for Windows. So why not use arabi for baoth, Farsi and Arabic. When there are isues with the arabi package in terms of resulting font, ligatures, etc. we should report it to the arabi people and I'm sure they will fix it for their next release. --- Besides this we have to corrent the fontencoding options, that are currently not correct also for Farsi, according to the documentation of the arabi-package. best regards Uwe
Re: problems to show figures in LyX
On Tue, Jun 19, 2007 at 04:22:59PM -0300, Fernando Roig wrote: Hi developers: I am running LyX 1.5.0rc1 on Windows XP SP2. When I include an eps graph, LyX is not able to show it but displays the message Error converting to loadable format I run lyxc.exe -dbg graphics and got the output below when including the graph. Does anybody knows what is going on? I can reproduce this bug. It occurs when the temp dir contains nonascii characters. The attached patch fixes it. José, OK to commit? -- Enrico Index: src/graphics/GraphicsConverter.cpp === --- src/graphics/GraphicsConverter.cpp (revision 18837) +++ src/graphics/GraphicsConverter.cpp (working copy) @@ -226,8 +226,8 @@ static string const move_file(string con return string(); ostringstream command; - command fromfile = from_file \n -tofile = to_file \n\n + command fromfile = utf8ToDefaultEncoding( from_file )\n +tofile = utf8ToDefaultEncoding(to_file )\n\n try:\n os.rename(fromfile, tofile)\n except:\n @@ -323,7 +323,8 @@ static void build_script(FileName const script infile = utf8ToDefaultEncoding( quoteName(from_file.absFilename(), quote_python) )\n - outfile = quoteName(outfile, quote_python) \n + outfile = utf8ToDefaultEncoding( +quoteName(outfile, quote_python) )\n shutil.copy(infile, outfile)\n; // Some converters (e.g. lilypond) can only output files to the @@ -331,15 +332,16 @@ static void build_script(FileName const // This has the added benefit that all other files that may be // generated by the converter are deleted when LyX closes and do not // clutter the real working directory. - script os.chdir( quoteName(onlyPath(outfile)) )\n; + script os.chdir(utf8ToDefaultEncoding( + quoteName(onlyPath(outfile)) ))\n; if (edgepath.empty()) { // Either from_format is unknown or we don't have a // converter path from from_format to to_format, so we use // the default converter. script infile = outfile\n - outfile = quoteName(to_file, quote_python) - '\n'; + outfile = utf8ToDefaultEncoding( + quoteName(to_file, quote_python) )\n; ostringstream os; os support::os::python() ' ' @@ -379,9 +381,12 @@ static void build_script(FileName const outfile = addExtension(to_base.absFilename(), conv.To-extension()); // Store these names in the python script - script infile =quoteName(infile, quote_python) \n - infile_base = quoteName(infile_base, quote_python) \n - outfile = quoteName(outfile, quote_python) '\n'; + script infile = utf8ToDefaultEncoding( +quoteName(infile, quote_python) )\n + infile_base = utf8ToDefaultEncoding( +quoteName(infile_base, quote_python) )\n + outfile = utf8ToDefaultEncoding( +quoteName(outfile, quote_python) )\n; // See comment about extra quotes above (although that // applies only for the first loop run here).
dead keys do not work properly
Hello: I am running LyX 1.5.0rc1 on Windows XP with a US keyboard configured as United States (international), so I can use dead keys. All dead keys work properly in LyX except the circumflex accent (^) key, which neither works in text mode nor in math mode (by the way, it works properly in other windows programs). Anybody knows what's going on. Fernando
Re: Can't enter extra whitespace when editing.
On Tue, 2007-06-19 at 17:51 +0200, Jean-Marc Lasgouttes wrote: Darren == Darren Freeman [EMAIL PROTECTED] writes: Darren My point was that in the past you could enter them and they Darren would be removed when you moved away, but now you can't enter Darren them at all. I vote for the older behaviour which feels more Darren natural. Are you sure? What version was that? I doubt that it has changed recently. I went from 1.3 to 1.5svn so sometime in-between. Have fun, Darren
Re: 2007 LyX Meeting: Invitation
Jean-Marc Lasgouttes wrote: > Too bad. Is it because you do not want us to discover that you are > actually a Spanish girl (and moreover mathematician)? Damn! How did you find out? Jürgen
[patch] bug 2520: Make InsetExternal translateable
http://bugzilla.lyx.org/show_bug.cgi?id=2520 The attached patch does this (I think it's the last remaining non-translatable ui part). Kudos to Neil Muller for his Python help. Remaining clumsyness is obviously my own, since I implemented it somewhat differently. Opinions? Jürgen Index: src/insets/InsetExternal.cpp === --- src/insets/InsetExternal.cpp (Revision 18821) +++ src/insets/InsetExternal.cpp (Arbeitskopie) @@ -577,8 +577,9 @@ return support::bformat((_("External template %1$s is not installed")), from_utf8(params.templatename())); // FIXME UNICODE + docstring gui = _(ptr->guiName); return from_utf8(external::doSubstitution(params, buffer, -ptr->guiName, false)); +to_utf8(gui), false)); } void add_preview_and_start_loading(RenderMonitoredPreview &, Index: src/frontends/qt4/QExternal.cpp === --- src/frontends/qt4/QExternal.cpp (Revision 18821) +++ src/frontends/qt4/QExternal.cpp (Arbeitskopie) @@ -544,7 +544,7 @@ for (std::vector::const_iterator cit = templates.begin(); cit != templates.end(); ++cit) { - dialog_->externalCO->addItem(toqstr(*cit)); + dialog_->externalCO->addItem(qt_(*cit)); } // Fill the origins combo @@ -604,7 +604,7 @@ { external::Template templ = controller().getTemplate(dialog_->externalCO->currentIndex()); - dialog_->externalTB->setPlainText(toqstr(templ.helpText)); + dialog_->externalTB->setPlainText(qt_(templ.helpText)); // Ascertain which (if any) transformations the template supports // and disable tabs hosting unsupported transforms. Index: po/Makefile.in.in === --- po/Makefile.in.in (Revision 18821) +++ po/Makefile.in.in (Arbeitskopie) @@ -376,7 +376,7 @@ sort | uniq ) > [EMAIL PROTECTED] \ && mv [EMAIL PROTECTED] $@ -l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot +l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot external_l10n.pot cat $^ | \ msguniq -o $(DOMAIN).po && rm -f $^ @@ -399,6 +399,9 @@ i18n.php: $(POFILES) postats.sh (cd $(srcdir) ; ./postats.sh $(POFILES)) >$@ +external_l10n.pot: $(top_srcdir)/lib/external_templates + python $(srcdir)/lyx_pot.py -b $(top_srcdir) -o $@ -t external ${top_srcdir}/lib/external_templates + force: # Tell versions [3.59,3.63) of GNU make not to export all variables. Index: po/lyx_pot.py === --- po/lyx_pot.py (Revision 18821) +++ po/lyx_pot.py (Arbeitskopie) @@ -145,6 +145,55 @@ output.close() +def external_l10n(input_files, output, base): +'''Generate pot file from lib/external_templates''' +output = open(output, 'w') +Template = re.compile(r'^Template\s+(.*)') +GuiName = re.compile(r'\s*GuiName\s+(.*)') +HelpTextStart = re.compile(r'\s*HelpText\s') +HelpTextSection = re.compile(r'\s*(\S.*)\s*$') +HelpTextEnd = re.compile(r'\s*HelpTextEnd\s') +i = -1 +for src in input_files: +input = open(src) +inHelp = False +hadHelp = False +prev_help_string = '' +for lineno, line in enumerate(input.readlines()): +if Template.match(line): +(string,) = Template.match(line).groups() +elif GuiName.match(line): +(string,) = GuiName.match(line).groups() +elif inHelp: +if HelpTextEnd.match(line): +if hadHelp: +print >> output, '\nmsgstr ""\n' +inHelp = False +hadHelp = False +prev_help_string = '' +elif HelpTextSection.match(line): +(help_string,) = HelpTextSection.match(line).groups() +help_string = help_string.replace('"', '') +if help_string != "" and prev_help_string == '': +print >> output, '#: %s:%d\nmsgid ""\n"%s\\n"' % \ +(relativePath(src, base), lineno+1, help_string) +hadHelp = True +elif help_string != "": +print >> output, '"%s\\n"' % help_string +prev_help_string = help_string +elif HelpTextStart.match(line): +inHelp = True +prev_help_string = '' +else: +continue +string = string.replace('"', '') +if string != "" and not inHelp: +print >> output, '#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \ +(relativePath(src, base), lineno+1, string) +input.close() +output.close() + + Usage = ''' lyx_pot.py [-b|--base top_src_dir] [-o|--output output_file] [-h|--help] -t|--type input_type input_files @@ -158,6 +207,7 @@ layouts: lib/layouts/*
Re: [patch] fix broken listings ui
Jürgen Spitzmüller wrote: > OK? Since it's obvious and harmless, I just committed. Jürgen
Re: RC2 coming soon
José Matos wrote: > I will start looking to remaining issues before RC2, AFAIR there are two > patches that I would like to have before the release, one by Jürgen that > has a file format change and another related with reverting documents to > 1.4. Yes. I keep on waiting for you to do the python part. Jürgen
Re: tex2lyx
> "Ekkehart" == Ekkehart Schlicht <[EMAIL PROTECTED]> writes: Ekkehart> I just imported a manuscript from a Latex file that has been Ekkehart> produced from a Document file (.doc) by exporting from Ekkehart> OpenOffice Writer 2.2. The tex file compiles well with Latex Ekkehart> and the outpurt is the best from all doc2tex coverters I Ekkehart> have tried. Ekkehart> Lyx 1.4.4-4 imports, but the imported file cannot be viewed Ekkehart> as PDF. Lots of complains: inmputenc error: keyboard Ekkehart> character is undefined. I guess this can be mended. In most Ekkehart> cases the complaint is just about some superfluous curly Ekkehart> brackets. Ekkehart> Lyx 1.50rc1 does not import at all. Ekkehart> If somebody is interested, I can produce a minimal example Ekkehart> next week. Hello, It would be interesting indeed to see a minimal file. JMarc
Re: [PATCH] do not replace deleted text
> "Michael" == Michael Gerz <[EMAIL PROTECTED]> writes: Michael> Hi, the following patch by Jürgen (with a minor fix by Michael> myself) prevents the replacement of deleted text. Michael> I tested the fix and it works. Is the thing correct when there is no selection? I would think the replace() then searches for the next hit. Of course, this is difficult to get right, but at least a FIXME would be useful. What happens when there is a multi paragraph selection? Does LyX just crash? JMarc
Re: XPM images --- a thought
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: Andre> Because that is not needed either. We can just the frontend's Andre> resource system and would not need to ship individual files at Andre> all. >> I do not think this gains anything. Andre> Slightly quicker loading of individual pixmaps at the price of Andre> slightly larger startup times (with a total gain) and less Andre> messy user side code. Compare Concerning icons: - from times to times, we have people contributing icons because it is so easy to do and they need it. Now only people with Qt tools will be able to do anything - what we want to do eventually is to rely as much as possible on standard icons with naming (tango?) defined by freedesktop.org. We will need to elaborate an icons loading procedure at this time (and I doubt it will be resource based, but I may be wrong). JMarc
Re: [PATCH] do not replace deleted text
Jean-Marc Lasgouttes wrote: > Is the thing correct when there is no selection? I would think the > replace() then searches for the next hit. Of course, this is difficult > to get right, but at least a FIXME would be useful. I would think everythink would be OK if the "replace" and "replace all" buttons would be greyed out if disabled. Why should "replace" do nothing but search for the next hit? > What happens when there is a multi paragraph selection? Does LyX just > crash? No. It does nothing (as it should IMHO). Jürgen
Re: some feedback on installing lyx1.5rc1 on windows
On Mon, 18 Jun 2007, "[EMAIL PROTECTED]" wrote: I assume you're rather computer savvy. Would you say above average (for a Windows user)? Yes, I think I could say above average. I'm able to install windows and have already tried ubuntu, puppy linux and some others. I'm using texlive under ubuntu and last tried miktex 2.4 on win98. I find the tex package management in miktex awesome, which allows to just install a basic system and installs on the fly any needed package upon compiling the tex file. That's some long needed feature under linux. This obviously needs to be clarfied. Did you look at any kind of documentation or description of the installer before chosing the bundled version? If so, would you mind looking again and say if you think there's an obvious place to put this 'caveat'? (I could add such an information, but I'd like to add it in a place where the user actually looks... :-) I didn't. From the news entry on the website, I went straight to the ftp site (ftp://ftp.devel.lyx.org/pub/lyx/pre/) where the binaries are located. There are just 2 windows installers to pick from for 1.5rc1: LyX-1.5.0rc1-Installer-bundle.exe LyX-1.5.0rc1-Installer.exe I picked the bundle, as I wanted to have one big package to handle everything at once and I assumed that one would do the trick. As for a caveat, one could write a readme file write on the ftp-site explaining the files. I didn't landed on the wiki (http://wiki.lyx.org/Windows/Windows) by means of the download page (http://www.lyx.org/download/), though. Regarding the bundle, the wiki page states: "This version includes all components and is intended to install LyX on multiple computers." Here one could be more explicit, explaining that aspell dictionaries and other miktex packages will still be (automatically) grabbed and installed from the internet during the installation. A few lines explaining why the alternative installer is different from the standard installer would be nice, too. The reason for why MikTeX wants/needs to go online should probably be added and explained. I don't know why, but others will probably tell us. I think now I know. I think that *the* basic miktex installation is installed with the standard installer. LyX doesn't need any extra packages to run (in my case, though, because of my choice of german and DINA4, it does need koma script to compile the documents), but LyX comes also with many templates for all sorts of documents (which is great!). For compiling the documents written in those templates some latex document class files are needed. Miktex knew this upon installation and tried to get them right away. For the record, every time I run LyX after a reboot miktex again asks for permission to download and install the missing packages. I also was wrong in my estimate: they are ~50. All the dictionary installers sum up to around 30-60 MB, so at worst it would almost double the size. That's a lot of MBs ;-). But still, from my point of view, it does make sense to provide an installer with everything on it, including spellchecking for the officially supported languages and sty-packages for the officially supported templates. Maybe you could not just include the basic miktex installer in your lyx installer, but a modified installer which already has the class packages that lyx will need? Uwe, does your complete installer contain dictionaries as well? If that's the case, Rafael might simply have been better off using that installer... Perhaps that's even the case with the MikTeX packages, I don't know. Rafael, did you look at the "alternative" installer? I didn't. See above. > Why this is needed in order to just run lyx escapes my > understanding. What's not obvious is that these aren't needed. I believe it's ok for MikTeX to fail to install these, and LyX will still run. Please correct me if this wasn't the case for you. LyX did run. See above. Thanks for answering. Best regards Rafael
Re: [PATCH] do not replace deleted text
> "Jürgen" == Jürgen Spitzmüller <[EMAIL PROTECTED]> writes: Jürgen> Jean-Marc Lasgouttes wrote: >> Is the thing correct when there is no selection? I would think the >> replace() then searches for the next hit. Of course, this is >> difficult to get right, but at least a FIXME would be useful. Jürgen> I would think everythink would be OK if the "replace" and Jürgen> "replace all" buttons would be greyed out if disabled. Why Jürgen> should "replace" do nothing but search for the next hit? My reading of the replace() function in lyxfind.cpp seemed to imply this. But I may be wrong. In particular, it seems to me that stringSelected is eventually invoked and can do an extra search. >> What happens when there is a multi paragraph selection? Does LyX >> just crash? Jürgen> No. It does nothing (as it should IMHO). + DocIterator beg = cur.selectionBegin(); + DocIterator end = cur.selectionEnd(); + bool enabled = true; + for (pos_type p = beg.pos() ; p < end.pos() ; ++p) { + if (cur.paragraph().isDeleted(p)) + enabled = false; + } reading the code above, I would say that it crashes if selectionBegin and selectionEnd are not the same paragraph and the paragraphs have different number of characters. First, can you even tell me which paragraph is cur.paragraph()? I think a test should be added. JMarc
Re: Insets Data Structure
Dov Feldstern wrote: Yeah, I don't know. I'm just basing this on the comment above. But I can't imagine that there are anywhere near 32-bits worth of unicode symbols... The Unicode standard defines that it has 21-bit code points, so there are 11 bits left that can be used. This number will not be changed in the future, unless they create a completely new standard. Joost
RE: RE: RE: Re: Empty Math Panel Popups
another approach: here i use the old math panel (the one that works for everyone) and draw a tear-off widget ourselves works fine for me so am seeking volunteers (esp mac and linux)! any takers? ;-) Index: src/frontends/qt4/IconPalette.cpp === --- src/frontends/qt4/IconPalette.cpp (revision 18822) +++ src/frontends/qt4/IconPalette.cpp (working copy) @@ -25,99 +25,82 @@ #include #include #include +#include namespace lyx { namespace frontend { -#if QT_VERSION >= 0x040200 - - -class MathButton : public QToolButton +TearOff::TearOff(QWidget * parent) + : QWidget(parent) { -public: - MathButton(QWidget * parent = 0) {} - void mouseReleaseEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); -}; + highlighted_ = false; + //setMinimumHeight(QStyle::PM_MenuTearoffHeight); + setMinimumHeight(10); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); +} -void MathButton::mouseReleaseEvent(QMouseEvent *event) +void TearOff::mouseReleaseEvent ( QMouseEvent * event ) { - QToolButton::mouseReleaseEvent(event); - event->ignore(); + // signal + tearOff(); } -void MathButton::mousePressEvent(QMouseEvent *event) +void TearOff::enterEvent(QEvent * event) { - QToolButton::mousePressEvent(event); + highlighted_ = true; + update(); event->ignore(); } -IconPalette::IconPalette(QWidget * parent) - : QWidgetAction(parent), size_(QSize(22, 22)) +void TearOff::leaveEvent(QEvent * event) { + highlighted_ = false; + update(); + event->ignore(); } - -void IconPalette::addButton(QAction * action) +void TearOff::paintEvent(QPaintEvent * event) { - actions_.push_back(action); -} +QPainter p(this); +QRegion emptyArea = QRegion(rect()); - -QWidget * IconPalette::createWidget(QWidget * parent) -{ - QWidget * widget = new QWidget(parent); - QGridLayout * layout = new QGridLayout(widget); - layout->setSpacing(0); - - for (int i = 0; i < actions_.size(); ++i) { - MathButton * tb = new MathButton(widget); - tb->setAutoRaise(true); - tb->setDefaultAction(actions_.at(i)); - tb->setIconSize(size_); - connect(this, SIGNAL(iconSizeChanged(const QSize &)), - tb, SLOT(setIconSize(const QSize &))); - - int const row = i/qMin(6, i + 1) + 1; - int const col = qMax(1, i + 1 - (row - 1) * 6); - layout->addWidget(tb, row, col); - } - - return widget; +const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); +QStyleOptionMenuItem menuOpt; +menuOpt.initFrom(this); +menuOpt.palette = palette(); +menuOpt.state = QStyle::State_None; +menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; +menuOpt.menuRect = rect(); +menuOpt.maxIconWidth = 0; +menuOpt.tabWidth = 0; +menuOpt.menuItemType = QStyleOptionMenuItem::TearOff; +menuOpt.rect.setRect(fw, fw, width() - (fw * 2), + style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); +emptyArea -= QRegion(menuOpt.rect); +p.setClipRect(menuOpt.rect); +menuOpt.state = QStyle::State_None; +if (highlighted_) +menuOpt.state |= QStyle::State_Selected; +style()->drawControl(QStyle::CE_MenuTearoff, , , this); } - -void IconPalette::setIconSize(const QSize & size) -{ - size_ = size; - // signal - iconSizeChanged(size); -} - - -void IconPalette::updateParent() -{ - bool enable = false; - for (int i = 0; i < actions_.size(); ++i) - if (actions_.at(i)->isEnabled()) { - enable = true; - break; - } - // signal - enabled(enable); -} - -#else // QT_VERSION >= 0x040200 - IconPalette::IconPalette(QWidget * parent) : QWidget(parent, Qt::Popup) { - layout_ = new QGridLayout(this); + tornoff_ = false; + QVBoxLayout * v = new QVBoxLayout(this); + v->setMargin(0); + layout_ = new QGridLayout; layout_->setSpacing(0); - layout_->setMargin(3); + layout_->setMargin(2); + tearoffwidget_ = new TearOff(this); + connect(tearoffwidget_, SIGNAL(tearOff()), this, SLOT(tearOff())); + tearoffwidget_->setMaximumSize(QSize(16777215, 10)); + v->addWidget(tearoffwidget_); + v->addLayout(layout_); } @@ -141,10 +124,20 @@ } +void IconPalette::tearOff() +{ + setWindowFlags(Qt::Tool); + tornoff_ = true; + tearoffwidget_->setVisible(!tornoff_); + show(); +} + + void IconPalette::clicked(QAction * action) { triggered(action); - setVisible(false); + if (!tornoff_) + setVisible(false); } @@ -191,6 +184,9 @@ void IconPalette::hideEvent(QHideEvent * event ) { visible(false); + setWindowFlags(Qt::Popup); + tornoff_ = false; + tearoffwidget_->setVisible(!tornoff_); QWidget::hideEvent(event); } @@ -234,7 +230,6 @@ // draw the rest (buttons) QWidget::paintEvent(event); } -#endif // QT_VERSION >= 0x040200 ButtonMenu::ButtonMenu(const QString & title, QWidget * parent) Index: src/frontends/qt4/IconPalette.h === --- src/frontends/qt4/IconPalette.h (revision 18822) +++
Re: [patch] bug 3764: Implicit \author field in .lyx files
> In contrary, my resources are limited at the moment. the quick fix is below. > Setting the user name to anonymous may be a good solution for the time being > (at least for 1.5rc2) provided that we can change back to the old settings at > no cost later. afaik the current situation is : 1. user can change from anonymous anytime if he decide (and find it:) in preferences. 2. patched functions are used only when no ~/.lyx/preferences is found - so this patch does not change previously saved settings. likewise once anonymous is saved in preferences, just starting new release of lyx wont automaticaly change from anonymous, so in this sense it is not revertible unless user voluntarily change it. pavel Index: src/support/userinfo.cpp === --- src/support/userinfo.cpp(revision 18822) +++ src/support/userinfo.cpp(working copy) @@ -36,6 +36,11 @@ docstring const user_name() { + //FIXME: quick fix wrt bug 3764; only Anonymous is detected now. + //The code after should be used only after user approval. + return from_local8bit("Anonymous"); + + #if defined (_WIN32) char name[UNLEN + 1]; @@ -57,6 +62,11 @@ docstring const user_email() { + //FIXME: quick fix wrt bug 3764; only Anonymous is detected now. + //The code after should be used only after user approval. + return docstring(); + + string email = getEnv("EMAIL_ADDRESS"); if (email.empty()) email = getEnv("EMAIL");
Re: tex2lyx
Jean-Marc: I deposited an example to http://www.semverteilung.vwl.uni-muenchen.de/temp/short.zip It contains 1. short.doc: Shortened version of a winword file I obtained from the publisher 2. short.tex: short.doc exported by OpenOfficeWriter 2.2 to Latex. As you can see it is rather clean. It woulkd be good however, to have a way for replacing things that LyX don't understand, like {\selectlanguage{english} or {\textasciigrave} from *within* lyx, rather than in an external editor. 3. short.pdf: PDF file generated from the (totally unmodified) short.tex As you will see, LyX 1.5 can't open it. Lyx 1.4.4 can, but does not produce Latex output. (View does not work here, on the same Latex system where short.tex compiled without any problem! Strange.) Maybe this is a useful real world test case that may be used to tune tex2lyx. Needless to say, I can produce a tex file readable by lyx from short.tex by replacing the preamble and doing various substitutions by hand. (I actually did so.) But it would be even better if Lyx could deal with such stuff automatically. Cheers and thanks Ekkehart Ekkehart shortened version of the WinWird file Jean-Marc Lasgouttes wrote: "Ekkehart" == Ekkehart Schlicht <[EMAIL PROTECTED]> writes: Ekkehart> I just imported a manuscript from a Latex file that has been Ekkehart> produced from a Document file (.doc) by exporting from Ekkehart> OpenOffice Writer 2.2. The tex file compiles well with Latex Ekkehart> and the outpurt is the best from all doc2tex coverters I Ekkehart> have tried. Ekkehart> Lyx 1.4.4-4 imports, but the imported file cannot be viewed Ekkehart> as PDF. Lots of complains: inmputenc error: keyboard Ekkehart> character is undefined. I guess this can be mended. In most Ekkehart> cases the complaint is just about some superfluous curly Ekkehart> brackets. Ekkehart> Lyx 1.50rc1 does not import at all. Ekkehart> If somebody is interested, I can produce a minimal example Ekkehart> next week. Hello, It would be interesting indeed to see a minimal file. JMarc
Re: [PATCH] do not replace deleted text
Jean-Marc Lasgouttes wrote: > >> Is the thing correct when there is no selection? I would think the > >> replace() then searches for the next hit. Of course, this is > >> difficult to get right, but at least a FIXME would be useful. > > Jürgen> I would think everythink would be OK if the "replace" and > Jürgen> "replace all" buttons would be greyed out if disabled. Why > Jürgen> should "replace" do nothing but search for the next hit? > > My reading of the replace() function in lyxfind.cpp seemed to imply > this. But I may be wrong. No, you're right. I've missed this. The attached patch proposes a different approach that looks more consistent. > In particular, it seems to me that > stringSelected is eventually invoked and can do an extra search. ??? > >> What happens when there is a multi paragraph selection? Does LyX > >> just crash? > > Jürgen> No. It does nothing (as it should IMHO). > > + DocIterator beg = cur.selectionBegin(); > + DocIterator end = cur.selectionEnd(); > + bool enabled = true; > + for (pos_type p = beg.pos() ; p < end.pos() ; ++p) { > + if (cur.paragraph().isDeleted(p)) > + enabled = false; > + } > > reading the code above, I would say that it crashes if selectionBegin > and selectionEnd are not the same paragraph and the paragraphs have > different number of characters. First, can you even tell me which > paragraph is cur.paragraph()? > > I think a test should be added. I see. Like in the attached? (I don't see the need to do the test for multiple paragraphs) > JMarc Jürgen Index: src/BufferView.cpp === --- src/BufferView.cpp (Revision 18821) +++ src/BufferView.cpp (Arbeitskopie) @@ -693,6 +693,7 @@ case LFUN_NOTE_NEXT: case LFUN_REFERENCE_NEXT: case LFUN_WORD_FIND: + case LFUN_WORD_REPLACE: case LFUN_MARK_OFF: case LFUN_MARK_ON: case LFUN_MARK_TOGGLE: @@ -704,10 +705,6 @@ flag.enabled(true); break; - case LFUN_WORD_REPLACE: - flag.enabled(!cur.paragraph().isDeleted(cur.pos())); - break; - case LFUN_LABEL_GOTO: { flag.enabled(!cmd.argument().empty() || getInsetByCode(cur, Inset::REF_CODE)); @@ -953,9 +950,21 @@ find(this, cmd); break; - case LFUN_WORD_REPLACE: - replace(this, cmd); + case LFUN_WORD_REPLACE: { + bool has_deleted = false; + if (cur.selection()) { + DocIterator beg = cur.selectionBegin(); + DocIterator end = cur.selectionEnd(); + if (beg.pit() == end.pit()) { +for (pos_type p = beg.pos() ; p < end.pos() ; ++p) { + if (cur.paragraph().isDeleted(p)) + has_deleted = true; +} + } + } + replace(this, cmd, has_deleted); break; + } case LFUN_MARK_OFF: cur.clearSelection(); Index: src/lyxfind.cpp === --- src/lyxfind.cpp (Revision 18821) +++ src/lyxfind.cpp (Arbeitskopie) @@ -298,7 +298,7 @@ } -void replace(BufferView * bv, FuncRequest const & ev) +void replace(BufferView * bv, FuncRequest const & ev, bool has_deleted) { if (!bv || ev.action != LFUN_WORD_REPLACE) return; @@ -319,23 +319,34 @@ Buffer * buf = bv->buffer(); - int const replace_count = all - ? replaceAll(bv, search, rplc, casesensitive, matchword) - : replace(bv, search, rplc, casesensitive, matchword, forward); - - if (replace_count == 0) { - // emit message signal. - buf->message(_("String not found!")); - } else { - if (replace_count == 1) { + if (!has_deleted) { + int const replace_count = all + ? replaceAll(bv, search, rplc, casesensitive, matchword) + : replace(bv, search, rplc, casesensitive, matchword, forward); + + if (replace_count == 0) { // emit message signal. - buf->message(_("String has been replaced.")); + buf->message(_("String not found!")); } else { - docstring str = convert(replace_count); - str += _(" strings have been replaced."); + if (replace_count == 1) { +// emit message signal. +buf->message(_("String has been replaced.")); + } else { +docstring str = convert(replace_count); +str += _(" strings have been replaced."); +// emit message signal. +buf->message(str); + } + } + } else { + // if we have deleted characters, we do not replace at all, but + // rather search for the next occurence + bool const found = find(bv, search, + casesensitive, matchword, forward); + + if (!found) // emit message signal. - buf->message(str); - } + bv->message(_("String not found!")); } } Index: src/lyxfind.h === --- src/lyxfind.h (Revision 18821) +++ src/lyxfind.h (Arbeitskopie) @@ -52,7 +52,7 @@ * \c ev.argument and act on it. * The string is encoded by \c replace2string. */ -void replace(BufferView * bv, FuncRequest const &); +void replace(BufferView * bv, FuncRequest const &, bool has_deleted = false); /// find the
RE: RE: RE: Re: Empty Math Panel Popups
Leuven, E. wrote: > another approach: > > here i use the old math panel (the one that works for everyone) > > and draw a tear-off widget ourselves > > works fine for me > > so am seeking volunteers (esp mac and linux)! > > any takers? ;-) Works fine here (linux, qt 4.2.3). Nice stuff. A/
Re: Empty Math Panel Popups
On Jun 19, 2007, at 6:08 AM, Leuven, E. wrote: another approach: here i use the old math panel (the one that works for everyone) and draw a tear-off widget ourselves works fine for me so am seeking volunteers (esp mac and linux)! any takers? ;-) It works on Mac, though it's not obvious that it should. The panel that pops up has a wider border on the top with an extra horizontal line, but nothing that looks like a title bar. Clicking on that wide border switches from the pop-up panel to the tear-off panel, complete with title bar; this tear-off panel can then be relocated and resized (though resizing does not result in a rearrangement of the icons). Bennett
RE: RE: RE: RE: Re: Empty Math Panel Popups
From: news on behalf of Alfredo Braunstein > Works fine here (linux, qt 4.2.3). Nice stuff. great. so if now some mac people can chime in...
RE: Empty Math Panel Popups
Bennett Helm wrote: > It works on Mac, though it's not obvious that it should. don't know what this means > The panel > that pops up has a wider border on the top with an extra horizontal > line, but nothing that looks like a title bar. sounds like intended behavior: this is the regular popup (click and it disappears) > Clicking on that wide > border switches from the pop-up panel to the tear-off panel, complete > with title bar; you got it > this tear-off panel can then be relocated and should stay on top (allow you to enter multiple symbols in a row) until you explicitly close it... > and > resized (though resizing does not result in a rearrangement of the > icons). nope
Re: Empty Math Panel Popups
On Jun 19, 2007, at 9:13 AM, Leuven, E. wrote: Bennett Helm wrote: It works on Mac, though it's not obvious that it should. don't know what this means What I meant is that when the panel pops up, there's no clear indication from its appearance that tearing it off can work, and so people won't likely try clicking there and discover the tear-off feature. Is there some other way to make this function more apparent? The panel that pops up has a wider border on the top with an extra horizontal line, but nothing that looks like a title bar. sounds like intended behavior: this is the regular popup (click and it disappears) Clicking on that wide border switches from the pop-up panel to the tear-off panel, complete with title bar; you got it this tear-off panel can then be relocated and should stay on top (allow you to enter multiple symbols in a row) until you explicitly close it... and resized (though resizing does not result in a rearrangement of the icons). nope But then it should not be resizable. Bennett
Re: [patch] Mini-buffer popup does not close on enter or space, #3588
Anybody tried it? Need another OK for committing. Stefan Am 18.06.2007 um 11:37 schrieb Abdelrazak Younes: Stefan Schimanski wrote: Sorry, I misread Key_Space for Key_Escape. But Key_Space of course doesn't look right as an LFUN can have arguments. That's the reason for Key_Space. Space will also select the current item and you can continue typing arguments. Note that also Enter will not issue the command, but go back to the command edit line. Ah... OK. Then OK ;-) Abdel. PGP.sig Description: Signierter Teil der Nachricht
Re: Can't enter extra whitespace when editing.
Darren Freeman wrote: On Mon, 2007-06-18 at 12:40 +0200, Hellmut Weber wrote: Hi Darren, don't you think that calling a lyx behaviour 'gestapo behaviour' is inappropriate? I don't think I spent any more than three seconds on it and hadn't considered it to be anything other than a little colourful. I was referring to the heavy-handed policing which LyX is now applying to extra white-space and I think I made my point. Removing those spaces from the screen is on purpose. LyX could let them through, but they will be stripped away when printing anyway, so better let you see what you are going to get anyway. Helge Hafting
RE: Empty Math Panel Popups
Bennett Helm wrote: > What I meant is that when the panel pops up, there's no clear indication > from its appearance that tearing it off can work, and so people won't > likely try clicking there and discover the tear-off feature. Is there > some other way to make this function more apparent? i've added a tooltip but for the moment tooltips don't show in the panels i don't know why: when we tear off the panel (ie set windowflags to Qt:Tool) they *do* show so i am afraid that for the moment this is just the way it is (unless someone else comes up with the solution)... > But then it should not be resizable. the attached patch does that ... in summary: - allow panels to tear off using only qt 4.1 functionality - reported to work on windows, linux and mac seeking 2 ok's Index: src/frontends/qt4/IconPalette.cpp === --- src/frontends/qt4/IconPalette.cpp (revision 18822) +++ src/frontends/qt4/IconPalette.cpp (working copy) @@ -25,99 +25,80 @@ #include #include #include +#include namespace lyx { namespace frontend { -#if QT_VERSION >= 0x040200 - - -class MathButton : public QToolButton +TearOff::TearOff(QWidget * parent) + : QWidget(parent) { -public: - MathButton(QWidget * parent = 0) {} - void mouseReleaseEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); -}; + highlighted_ = false; + setMinimumHeight(8); + setToolTip(qt_("Click to tear off")); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); +} -void MathButton::mouseReleaseEvent(QMouseEvent *event) +void TearOff::mouseReleaseEvent(QMouseEvent * event) { - QToolButton::mouseReleaseEvent(event); - event->ignore(); + // signal + tearOff(); } -void MathButton::mousePressEvent(QMouseEvent *event) +void TearOff::enterEvent(QEvent * event) { - QToolButton::mousePressEvent(event); + highlighted_ = true; + update(); event->ignore(); } -IconPalette::IconPalette(QWidget * parent) - : QWidgetAction(parent), size_(QSize(22, 22)) +void TearOff::leaveEvent(QEvent * event) { + highlighted_ = false; + update(); + event->ignore(); } -void IconPalette::addButton(QAction * action) +void TearOff::paintEvent(QPaintEvent * event) { - actions_.push_back(action); + QPainter p(this); + const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); + QStyleOptionMenuItem menuOpt; + menuOpt.initFrom(this); + menuOpt.palette = palette(); + menuOpt.state = QStyle::State_None; + menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; + menuOpt.menuRect = rect(); + menuOpt.maxIconWidth = 0; + menuOpt.tabWidth = 0; + menuOpt.menuItemType = QStyleOptionMenuItem::TearOff; + menuOpt.rect.setRect(fw, fw, width() - (fw * 2), + style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); + p.setClipRect(menuOpt.rect); + menuOpt.state = QStyle::State_None; + if (highlighted_) + menuOpt.state |= QStyle::State_Selected; + style()->drawControl(QStyle::CE_MenuTearoff, , , this); } -QWidget * IconPalette::createWidget(QWidget * parent) -{ - QWidget * widget = new QWidget(parent); - QGridLayout * layout = new QGridLayout(widget); - layout->setSpacing(0); - - for (int i = 0; i < actions_.size(); ++i) { - MathButton * tb = new MathButton(widget); - tb->setAutoRaise(true); - tb->setDefaultAction(actions_.at(i)); - tb->setIconSize(size_); - connect(this, SIGNAL(iconSizeChanged(const QSize &)), - tb, SLOT(setIconSize(const QSize &))); - - int const row = i/qMin(6, i + 1) + 1; - int const col = qMax(1, i + 1 - (row - 1) * 6); - layout->addWidget(tb, row, col); - } - - return widget; -} - - -void IconPalette::setIconSize(const QSize & size) -{ - size_ = size; - // signal - iconSizeChanged(size); -} - - -void IconPalette::updateParent() -{ - bool enable = false; - for (int i = 0; i < actions_.size(); ++i) - if (actions_.at(i)->isEnabled()) { - enable = true; - break; - } - // signal - enabled(enable); -} - -#else // QT_VERSION >= 0x040200 - IconPalette::IconPalette(QWidget * parent) - : QWidget(parent, Qt::Popup) + : QWidget(parent, Qt::Popup), tornoff_(false) { - layout_ = new QGridLayout(this); + QVBoxLayout * v = new QVBoxLayout(this); + v->setMargin(0); + v->setSpacing(0); + layout_ = new QGridLayout; layout_->setSpacing(0); - layout_->setMargin(3); + layout_->setMargin(2); + tearoffwidget_ = new TearOff(this); + connect(tearoffwidget_, SIGNAL(tearOff()), this, SLOT(tearOff())); + v->addWidget(tearoffwidget_); + v->addLayout(layout_); } @@ -141,15 +122,30 @@ } +void IconPalette::tearOff() +{ + blockSignals(true); + setWindowFlags(Qt::Tool); + tornoff_ = true; + tearoffwidget_->setVisible(!tornoff_); + show(); + blockSignals(false); +} + + void IconPalette::clicked(QAction * action) { triggered(action); - setVisible(false); + if (!tornoff_) + setVisible(false); } void IconPalette::showEvent(QShowEvent * event) { + resize(sizeHint()); + setMaximumSize(sizeHint()); + int hoffset = -
Re: Can't enter extra whitespace when editing.
On Tue, 2007-06-19 at 15:58 +0200, Helge Hafting wrote: > Darren Freeman wrote: > > considered it to be anything other than a little colourful. I was > > referring to the heavy-handed policing which LyX is now applying to > > extra white-space and I think I made my point. > > > Removing those spaces from the screen is on purpose. > LyX could let them through, but they will be stripped away > when printing anyway, so better let you see what you are > going to get anyway. My point was that in the past you could enter them and they would be removed when you moved away, but now you can't enter them at all. I vote for the older behaviour which feels more natural. Have fun, Darren
[Updated PATCH] Child TOC Crash, Again
Abdelrazak Younes wrote: Richard Heck wrote: The attached patch builds on Abdel's earlier work and, I think, solves the remaining problems. Whether this is the best way to do it, I'm not sure. Abdel was talking about a more major re-organization of the code, but maybe that could wait. Maybe yes. What I've done is add an optional argument to LFUN_BUFFER_CHILD_OPEN indicating whether the file is being auto-loaded. (Contrary to what I said before, this is ok, since we're expecting a valid LyX filename, and one isn't going to end with "|true".) There are also corresponding booleans in LyXView::loadLyXFile and BufferView::loadLyXFile. At this point BufferView::loadLyXFile() do not need to be a member of BufferView so please put that in buffer_func.cpp along the other loadLyXFile(). Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). I hope everything is OK with your daughter. Cheers, Abdel. Index: Buffer.cpp === --- Buffer.cpp (revision 18822) +++ Buffer.cpp (working copy) @@ -1616,7 +1616,11 @@ void Buffer::setParentName(string const & name) { - params().parentname = name; + if (name == pimpl_->filename.absFilename()) + // Avoids recursive include. + params().parentname.clear(); + else + params().parentname = name; } Index: buffer_funcs.cpp === --- buffer_funcs.cpp(revision 18822) +++ buffer_funcs.cpp(working copy) @@ -180,6 +180,47 @@ return false; } +// FIXME: all of this should go in a helper file in buffer_func. +Buffer * checkAndLoadLyXFile(FileName const & filename) +{ + // File already open? + if (theBufferList().exists(filename.absFilename())) { + docstring const file = makeDisplayPath(filename.absFilename(), 20); + docstring text = bformat(_("The document %1$s is already " +"loaded.\n\nDo you want to revert " +"to the saved version?"), file); + if (Alert::prompt(_("Revert to saved document?"), + text, 0, 1, _(""), _(" to document"))) + return theBufferList().getBuffer(filename.absFilename()); + + // FIXME: should be LFUN_REVERT + if (theBufferList().close(theBufferList().getBuffer(filename.absFilename()), false)) + // Load it again. + return checkAndLoadLyXFile(filename); + else + // The file could not be closed. + return 0; + } + + if (isFileReadable(filename)) { + Buffer * b = theBufferList().newBuffer(filename.absFilename()); + if (!lyx::loadLyXFile(b, filename)) { + theBufferList().release(b); + return 0; + } + return b; + } + + docstring text = bformat(_("The document %1$s does not yet " + "exist.\n\nDo you want to create a new document?"), + from_utf8(filename.absFilename())); + if (Alert::prompt(_("Create new document?"), + text, 0, 1, _(""), _("Cancel")) + return newFile(filename.absFilename(), string(), true); + + return 0; +} + // FIXME newFile() should probably be a member method of Application... Buffer * newFile(string const & filename, string const & templatename, bool const isNamed) Index: buffer_funcs.h === --- buffer_funcs.h (revision 18822) +++ buffer_funcs.h (working copy) @@ -34,6 +34,13 @@ */ bool loadLyXFile(Buffer *, support::FileName const & filename); +/** + * Checks and loads a LyX file \param filename. + * \retval the newly created \c Buffer pointer if successful or 0. + * \retval 0 if the \c Buffer could not be created. + */ +Buffer * checkAndLoadLyXFile(support::FileName const & filename); + /* Make a new file (buffer) with name \c filename based on a template * named \c templatename */ Index: BufferView.cpp === --- BufferView.cpp (revision 18822) +++ BufferView.cpp (working copy) @@ -233,78 +233,6 @@ graphics::Previews::get().generateBufferPreviews(*buffer_); } - -bool BufferView::loadLyXFile(FileName const & filename, bool tolastfiles) -{ - // File already open? - if (theBufferList().exists(filename.absFilename())) { - docstring const file = makeDisplayPath(filename.absFilename(), 20); - docstring text = bformat(_("The document %1$s is already " -"loaded.\n\nDo
[Updated PATCH 2] Child TOC Crash, Again
Abdelrazak Younes wrote: Abdelrazak Younes wrote: Richard Heck wrote: The attached patch builds on Abdel's earlier work and, I think, solves the remaining problems. Whether this is the best way to do it, I'm not sure. Abdel was talking about a more major re-organization of the code, but maybe that could wait. Maybe yes. What I've done is add an optional argument to LFUN_BUFFER_CHILD_OPEN indicating whether the file is being auto-loaded. (Contrary to what I said before, this is ok, since we're expecting a valid LyX filename, and one isn't going to end with "|true".) There are also corresponding booleans in LyXView::loadLyXFile and BufferView::loadLyXFile. At this point BufferView::loadLyXFile() do not need to be a member of BufferView so please put that in buffer_func.cpp along the other loadLyXFile(). Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). Here is a patch that actually compiles and works for all use cases. Abdel. Index: Buffer.cpp === --- Buffer.cpp (revision 18822) +++ Buffer.cpp (working copy) @@ -1616,7 +1616,11 @@ void Buffer::setParentName(string const & name) { - params().parentname = name; + if (name == pimpl_->filename.absFilename()) + // Avoids recursive include. + params().parentname.clear(); + else + params().parentname = name; } Index: buffer_funcs.cpp === --- buffer_funcs.cpp(revision 18822) +++ buffer_funcs.cpp(working copy) @@ -180,6 +180,47 @@ return false; } +// FIXME: all of this should go in a helper file in buffer_func. +Buffer * checkAndLoadLyXFile(FileName const & filename) +{ + // File already open? + if (theBufferList().exists(filename.absFilename())) { + docstring const file = makeDisplayPath(filename.absFilename(), 20); + docstring text = bformat(_("The document %1$s is already " +"loaded.\n\nDo you want to revert " +"to the saved version?"), file); + if (Alert::prompt(_("Revert to saved document?"), + text, 0, 1, _(""), _(" to document"))) + return theBufferList().getBuffer(filename.absFilename()); + + // FIXME: should be LFUN_REVERT + if (theBufferList().close(theBufferList().getBuffer(filename.absFilename()), false)) + // Load it again. + return checkAndLoadLyXFile(filename); + else + // The file could not be closed. + return 0; + } + + if (isFileReadable(filename)) { + Buffer * b = theBufferList().newBuffer(filename.absFilename()); + if (!lyx::loadLyXFile(b, filename)) { + theBufferList().release(b); + return 0; + } + return b; + } + + docstring text = bformat(_("The document %1$s does not yet " + "exist.\n\nDo you want to create a new document?"), + from_utf8(filename.absFilename())); + if (Alert::prompt(_("Create new document?"), + text, 0, 1, _(""), _("Cancel"))) + return newFile(filename.absFilename(), string(), true); + + return 0; +} + // FIXME newFile() should probably be a member method of Application... Buffer * newFile(string const & filename, string const & templatename, bool const isNamed) Index: buffer_funcs.h === --- buffer_funcs.h (revision 18822) +++ buffer_funcs.h (working copy) @@ -34,6 +34,13 @@ */ bool loadLyXFile(Buffer *, support::FileName const & filename); +/** + * Checks and loads a LyX file \param filename. + * \retval the newly created \c Buffer pointer if successful or 0. + * \retval 0 if the \c Buffer could not be created. + */ +Buffer * checkAndLoadLyXFile(support::FileName const & filename); + /* Make a new file (buffer) with name \c filename based on a template * named \c templatename */ Index: BufferView.cpp === --- BufferView.cpp (revision 18822) +++ BufferView.cpp (working copy) @@ -233,78 +233,6 @@ graphics::Previews::get().generateBufferPreviews(*buffer_); } - -bool BufferView::loadLyXFile(FileName const & filename, bool tolastfiles) -{ - // File already open? - if (theBufferList().exists(filename.absFilename())) { - docstring const file = makeDisplayPath(filename.absFilename(), 20); - docstring text = bformat(_("The document %1$s is already " -
Re: [Updated PATCH 2] Child TOC Crash, Again
Abdelrazak Younes wrote: Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). Here is a patch that actually compiles and works for all use cases. Whoops. I just committed the other one, per your suggestion. If you want to revert and commit this one, that's fine with me. I forgot to say in the log note that this was mostly your work, too. Richard Index: Buffer.cpp === --- Buffer.cpp (revision 18822) +++ Buffer.cpp (working copy) @@ -1616,7 +1616,11 @@ void Buffer::setParentName(string const & name) { - params().parentname = name; + if (name == pimpl_->filename.absFilename()) + // Avoids recursive include. + params().parentname.clear(); + else + params().parentname = name; } Index: buffer_funcs.cpp === --- buffer_funcs.cpp(revision 18822) +++ buffer_funcs.cpp(working copy) @@ -180,6 +180,47 @@ return false; } +// FIXME: all of this should go in a helper file in buffer_func. +Buffer * checkAndLoadLyXFile(FileName const & filename) +{ + // File already open? + if (theBufferList().exists(filename.absFilename())) { + docstring const file = makeDisplayPath(filename.absFilename(), 20); + docstring text = bformat(_("The document %1$s is already " +"loaded.\n\nDo you want to revert " +"to the saved version?"), file); + if (Alert::prompt(_("Revert to saved document?"), + text, 0, 1, _(""), _(" to document"))) + return theBufferList().getBuffer(filename.absFilename()); + + // FIXME: should be LFUN_REVERT + if (theBufferList().close(theBufferList().getBuffer(filename.absFilename()), false)) + // Load it again. + return checkAndLoadLyXFile(filename); + else + // The file could not be closed. + return 0; + } + + if (isFileReadable(filename)) { + Buffer * b = theBufferList().newBuffer(filename.absFilename()); + if (!lyx::loadLyXFile(b, filename)) { + theBufferList().release(b); + return 0; + } + return b; + } + + docstring text = bformat(_("The document %1$s does not yet " + "exist.\n\nDo you want to create a new document?"), + from_utf8(filename.absFilename())); + if (Alert::prompt(_("Create new document?"), + text, 0, 1, _(""), _("Cancel"))) + return newFile(filename.absFilename(), string(), true); + + return 0; +} + // FIXME newFile() should probably be a member method of Application... Buffer * newFile(string const & filename, string const & templatename, bool const isNamed) Index: buffer_funcs.h === --- buffer_funcs.h (revision 18822) +++ buffer_funcs.h (working copy) @@ -34,6 +34,13 @@ */ bool loadLyXFile(Buffer *, support::FileName const & filename); +/** + * Checks and loads a LyX file \param filename. + * \retval the newly created \c Buffer pointer if successful or 0. + * \retval 0 if the \c Buffer could not be created. + */ +Buffer * checkAndLoadLyXFile(support::FileName const & filename); + /* Make a new file (buffer) with name \c filename based on a template * named \c templatename */ Index: BufferView.cpp === --- BufferView.cpp (revision 18822) +++ BufferView.cpp (working copy) @@ -233,78 +233,6 @@ graphics::Previews::get().generateBufferPreviews(*buffer_); } - -bool BufferView::loadLyXFile(FileName const & filename, bool tolastfiles) -{ - // File already open? - if (theBufferList().exists(filename.absFilename())) { - docstring const file = makeDisplayPath(filename.absFilename(), 20); - docstring text = bformat(_("The document %1$s is already " -"loaded.\n\nDo you want to revert " -"to the saved version?"), file); - int const ret = Alert::prompt(_("Revert to saved document?"), - text, 0, 1, _(""), _(" to document")); - - if (ret != 0) { - setBuffer(theBufferList().getBuffer(filename.absFilename())); - return true; - } - // FIXME: should be LFUN_REVERT -
Re: [patch] fix broken listings ui
On 6/19/07, Jürgen Spitzmüller <[EMAIL PROTECTED]> wrote: Jürgen Spitzmüller wrote: > OK? Since it's obvious and harmless, I just committed. +1, though late. Bo
Re: [Updated PATCH 2] Child TOC Crash, Again
Richard Heck wrote: Abdelrazak Younes wrote: Hi Richard, I've done that and did a bit more simplifications. Patch attached (not tested yet). Here is a patch that actually compiles and works for all use cases. Whoops. I just committed the other one, per your suggestion. If you want to revert and commit this one, that's fine with me. I fixed some other issues in my updated patch WRT the error list, the unneeded dialog updates and a few other things that I don't recall... So, I think I will do that... unless you prefer that I update my patch to current SVN (or you do it ;-). I forgot to say in the log note that this was mostly your work, too. No problem. Abdel.
Re: Can't enter extra whitespace when editing.
> "Darren" == Darren Freeman <[EMAIL PROTECTED]> writes: Darren> My point was that in the past you could enter them and they Darren> would be removed when you moved away, but now you can't enter Darren> them at all. I vote for the older behaviour which feels more Darren> natural. Are you sure? What version was that? I doubt that it has changed recently. JMarc
Re: r18826 - /lyx-devel/trunk/src/BufferView.cpp
[EMAIL PROTECTED] wrote: Author: rgheck Date: Tue Jun 19 16:59:34 2007 New Revision: 18826 URL: http://www.lyx.org/trac/changeset/18826 Log: Trivial whitespace fix. Sorry but it doesn't look trivial... Modified: lyx-devel/trunk/src/BufferView.cpp Modified: lyx-devel/trunk/src/BufferView.cpp URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/BufferView.cpp?rev=18826 == --- lyx-devel/trunk/src/BufferView.cpp (original) +++ lyx-devel/trunk/src/BufferView.cpp Tue Jun 19 16:59:34 2007 @@ -209,26 +209,26 @@ if (!buffer_) return; - LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION - << "Buffer addr: " << buffer_ << endl; - cursor_.push(buffer_->inset()); + LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION + << "Buffer addr: " << buffer_ << endl; + cursor_.push(buffer_->inset()); + cursor_.resetAnchor(); + buffer_->text().setCurrentFont(cursor_); + if (buffer_->getCursor().size() > 0 && + buffer_->getAnchor().size() > 0) + { + cursor_.setCursor(buffer_->getAnchor().asDocIterator(&(buffer_->inset(; cursor_.resetAnchor(); - buffer_->text().setCurrentFont(cursor_); - if (buffer_->getCursor().size() > 0 && - buffer_->getAnchor().size() > 0) - { - cursor_.setCursor(buffer_->getAnchor().asDocIterator(&(buffer_->inset(; - cursor_.resetAnchor(); - cursor_.setCursor(buffer_->getCursor().asDocIterator(&(buffer_->inset(; - cursor_.setSelection(); - // do not set selection to the new buffer because we - // only paste recent selection. - - // Make sure that the restored cursor is not broken. This can happen for - // example if this Buffer has been modified by another view. - cursor_.fixIfBroken(); - } - updateMetrics(false); + cursor_.setCursor(buffer_->getCursor().asDocIterator(&(buffer_->inset(; + cursor_.setSelection(); + // do not set selection to the new buffer because we + // only paste recent selection. + + // Make sure that the restored cursor is not broken. This can happen for + // example if this Buffer has been modified by another view. + cursor_.fixIfBroken(); + } + updateMetrics(false); if (graphics::Previews::status() != LyXRC::PREVIEW_OFF) graphics::Previews::get().generateBufferPreviews(*buffer_); }
Re: [PATCH] do not replace deleted text
> "Jürgen" == Jürgen Spitzmüller <[EMAIL PROTECTED]> writes: Jürgen> I see. Like in the attached? (I don't see the need to do the Jürgen> test for multiple paragraphs) It looks better, but I'll let Michael decide. JMarc
Re: r18826 - /lyx-devel/trunk/src/BufferView.cpp
Abdelrazak Younes wrote: [EMAIL PROTECTED] wrote: Author: rgheck Date: Tue Jun 19 16:59:34 2007 New Revision: 18826 URL: http://www.lyx.org/trac/changeset/18826 Log: Trivial whitespace fix. Sorry but it doesn't look trivial... OK, got it. Abdel.
Re: Empty Math Panel Popups
On Tue, Jun 19, 2007 at 04:14:18PM +0200, Leuven, E. wrote: > in summary: > > - allow panels to tear off using only qt 4.1 functionality > > - reported to work on windows, linux and mac > > seeking 2 ok's Edwin, I really appreciate your effort for trying to provide this feature with Qt 4.1. However, I think that we should not jump through hoops if something is hard to obtain with older Qt versions. It suffices to let the thing compile, even with reduced functionality. I tried the patch with Qt 4.1 and it almost works (I am really impressed). There's a quirk, though. After detaching a panel and trying to close it again, LyX freezes. There's no cpu load, LyX simply doesn't respond anymore and after a Ctrl-C an emergency file is created. Taking into account the time and effort you put in this, I am really afraid to suggest leaving things as they are now and simply applying that small patch curing the moc problem. What do you (and others) think? -- Enrico
[Patch] Bugfix: last Buffer position is not remembered on buffer switch
Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. The fix is simple. The removed code is already done on Buffer deletion thanks to the Buffer::closing() signal connection to LyXView. Setting the Buffer twice was the reason of the bug. OK? Abdel. Index: LyXFunc.cpp === --- LyXFunc.cpp (revision 18827) +++ LyXFunc.cpp (working copy) @@ -2089,16 +2089,8 @@ // goto bookmark to update bookmark pit. for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i) gotoBookmark(i+1, false, false); - if (theBufferList().close(lyx_view_->buffer(), true) && !quitting) { - if (theBufferList().empty()) { - // need this otherwise SEGV may occur while - // trying to set variables that don't exist - // since there's no current buffer - lyx_view_->getDialogs().hideBufferDependent(); - } else { - lyx_view_->setBuffer(theBufferList().first()); - } - } + + theBufferList().close(lyx_view_->buffer(), true); }
Re: Bromarv
> "christian" == christian ridderstrom <[EMAIL PROTECTED]> writes: christian> On Mon, 18 Jun 2007, Andre Poenitz wrote: >> Now that I was too stupid to get my booking right the first time, I >> again have a choice of dates. >> >> Originally I was thinking about Thursday-Monday "as usual" but >> given the timetables that'd mean absolutely no work on Thursday and >> Monday, which is a bit below "business as usual". So I think about >> taking the return flight on Tuesday - which, otoh, would not be >> _that_ nice if I were the only one hanging around in the waters of >> Finland ;-} >> >> So: When do other people come? christian> I'm flexible and I'd enjoy doing something on Tuesday. I christian> might stay around another day as well for that matter. So christian> far I haven't decided if I'll fly there, or go by ferry and christian> motorcycle/car. Looking at the timetables, only Finnair gives me an arrival date of 11h40 on Thursday (which is OK to catch the bus), but the return would have to be on monday (12h15) or wednesday. Last week there were many other flights, and with more interesting rates :( But in principle I would like to stay until tuesday. JMarc
Re: [PATCH] do not replace deleted text
Jean-Marc Lasgouttes wrote: > It looks better, but I'll let Michael decide. OK. Michael, if you're fine with this as well, just commit it. Jürgen
Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Abdelrazak Younes wrote: > Use case: > > 1) Open doc1 > 2) scroll a bit > 3) open doc2 > 4) close doc2 > > Bug: The cursor is not at last position of doc1 and the screen is not > redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 I've no time to test ATM, but your explanation makes sense. Jürgen
Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 No this is something else (that really needs to be fixed IMHO). This bug is on Buffer _close_. I've no time to test ATM, but your explanation makes sense. And it is really straight forward. Another OK someone? Abdel.
[PATCH] Fix bug 3171 (was Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 Actually the fix for bug 3171 is in Buffer::setBuffer(). But the fix to the bug above is needed for bug 3171 too. OK, who said OK? Abdel. Index: BufferView.cpp === --- BufferView.cpp (revision 18828) +++ BufferView.cpp (working copy) @@ -209,11 +209,14 @@ if (!buffer_) return; + updateMetrics(false); + LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION << "Buffer addr: " << buffer_ << endl; cursor_.push(buffer_->inset()); cursor_.resetAnchor(); buffer_->text().setCurrentFont(cursor_); + if (buffer_->getCursor().size() > 0 && buffer_->getAnchor().size() > 0) { @@ -227,12 +230,15 @@ // Make sure that the restored cursor is not broken. This can happen for // example if this Buffer has been modified by another view. cursor_.fixIfBroken(); + if (fitCursor()) + updateMetrics(false); } - updateMetrics(false); + if (graphics::Previews::status() != LyXRC::PREVIEW_OFF) graphics::Previews::get().generateBufferPreviews(*buffer_); } + void BufferView::resize() { if (!buffer_) Index: LyXFunc.cpp === --- LyXFunc.cpp (revision 18827) +++ LyXFunc.cpp (working copy) @@ -2089,16 +2089,8 @@ // goto bookmark to update bookmark pit. for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i) gotoBookmark(i+1, false, false); - if (theBufferList().close(lyx_view_->buffer(), true) && !quitting) { - if (theBufferList().empty()) { - // need this otherwise SEGV may occur while - // trying to set variables that don't exist - // since there's no current buffer - lyx_view_->getDialogs().hideBufferDependent(); - } else { - lyx_view_->setBuffer(theBufferList().first()); - } - } + + theBufferList().close(lyx_view_->buffer(), true); }
Re: [PATCH] Fix bug 3171 (was Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Abdelrazak Younes wrote: Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Use case: 1) Open doc1 2) scroll a bit 3) open doc2 4) close doc2 Bug: The cursor is not at last position of doc1 and the screen is not redrawn. This is bug 3171, right? http://bugzilla.lyx.org/show_bug.cgi?id=3171 Actually the fix for bug 3171 is in Buffer::setBuffer(). But the fix to the bug above is needed for bug 3171 too. OK, who said OK? Sorry, I couldn't wait cause I'll be off for a few days and I didn't want RC2 to behave like this. The fix is simple anyway and could be reverted easily if you think I was too fast. Abdel.
Re: [PATCH] Fix bug 3171 (was Re: [Patch] Bugfix: last Buffer position is not remembered on buffer switch
Abdelrazak Younes wrote: > I'll be off for a few days and I didn't > want RC2 to behave like this. Me as well (until the weekend). So if you think any of the patches I posted should go in, feel free to commit them. Jürgen
Re: Empty Math Panel Popups
Enrico Forestieri wrote: Edwin, I really appreciate your effort for trying to provide this feature with Qt 4.1. However, I think that we should not jump through hoops if something is hard to obtain with older Qt versions. It suffices to let the thing compile, even with reduced functionality. I tried the patch with Qt 4.1 and it almost works (I am really impressed). There's a quirk, though. After detaching a panel and trying to close it again, LyX freezes. There's no cpu load, LyX simply doesn't respond anymore and after a Ctrl-C an emergency file is created. i admit i was using qt 4.2 i now compiled with 4.1 and it turns out we cannot change windowflags on visible windows hiding the widget before changing the windowflags solves the problem for me could you try the attached? Taking into account the time and effort you put in this, I am really afraid to suggest leaving things as they are now and simply applying that small patch curing the moc problem. What do you (and others) think? the attached patch has the advantage that it also allows tearoff panels on the mac i would be very surprised if this one doesn't work for you Index: src/frontends/qt4/IconPalette.cpp === --- src/frontends/qt4/IconPalette.cpp (revision 18822) +++ src/frontends/qt4/IconPalette.cpp (working copy) @@ -25,99 +25,81 @@ #include #include #include +#include namespace lyx { namespace frontend { -#if QT_VERSION >= 0x040200 - - -class MathButton : public QToolButton +TearOff::TearOff(QWidget * parent) + : QWidget(parent) { -public: - MathButton(QWidget * parent = 0) {} - void mouseReleaseEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); -}; + highlighted_ = false; + setMinimumHeight(8); + setToolTip(qt_("Click to tear off")); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); +} -void MathButton::mouseReleaseEvent(QMouseEvent *event) +void TearOff::mouseReleaseEvent(QMouseEvent * event) { - QToolButton::mouseReleaseEvent(event); - event->ignore(); + // signal + tearOff(); } -void MathButton::mousePressEvent(QMouseEvent *event) +void TearOff::enterEvent(QEvent * event) { - QToolButton::mousePressEvent(event); + highlighted_ = true; + update(); event->ignore(); } -IconPalette::IconPalette(QWidget * parent) - : QWidgetAction(parent), size_(QSize(22, 22)) +void TearOff::leaveEvent(QEvent * event) { + highlighted_ = false; + update(); + event->ignore(); } -void IconPalette::addButton(QAction * action) +void TearOff::paintEvent(QPaintEvent * event) { - actions_.push_back(action); + QPainter p(this); + const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); + QStyleOptionMenuItem menuOpt; + menuOpt.initFrom(this); + menuOpt.palette = palette(); + menuOpt.state = QStyle::State_None; + menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; + menuOpt.menuRect = rect(); + menuOpt.maxIconWidth = 0; + menuOpt.tabWidth = 0; + menuOpt.menuItemType = QStyleOptionMenuItem::TearOff; + menuOpt.rect.setRect(fw, fw, width() - (fw * 2), + style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); + p.setClipRect(menuOpt.rect); + menuOpt.state = QStyle::State_None; + if (highlighted_) + menuOpt.state |= QStyle::State_Selected; + style()->drawControl(QStyle::CE_MenuTearoff, , , this); } -QWidget * IconPalette::createWidget(QWidget * parent) -{ - QWidget * widget = new QWidget(parent); - QGridLayout * layout = new QGridLayout(widget); - layout->setSpacing(0); - - for (int i = 0; i < actions_.size(); ++i) { - MathButton * tb = new MathButton(widget); - tb->setAutoRaise(true); - tb->setDefaultAction(actions_.at(i)); - tb->setIconSize(size_); - connect(this, SIGNAL(iconSizeChanged(const QSize &)), - tb, SLOT(setIconSize(const QSize &))); - - int const row = i/qMin(6, i + 1) + 1; - int const col = qMax(1, i + 1 - (row - 1) * 6); - layout->addWidget(tb, row, col); - } - - return widget; -} - - -void IconPalette::setIconSize(const QSize & size) -{ - size_ = size; - // signal - iconSizeChanged(size); -} - - -void IconPalette::updateParent() -{ - bool enable = false; - for (int i = 0; i < actions_.size(); ++i) - if (actions_.at(i)->isEnabled()) { - enable = true; - break; - } - // signal - enabled(enable); -} - -#else // QT_VERSION >= 0x040200 - IconPalette::IconPalette(QWidget * parent) - : QWidget(parent, Qt::Popup) + : QWidget(parent, Qt::Popup), tornoff_(false) { - layout_ = new QGridLayout(this); + QVBoxLayout * v = new QVBoxLayout(this); + v->setMargin(0); + v->setSpacing(0); + layout_ = new QGridLayout; layout_->setSpacing(0); - layout_->setMargin(3); + const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); + layout_->setMargin(fw); + tearoffwidget_ = new TearOff(this); + connect(tearoffwidget_, SIGNAL(tearOff()), this, SLOT(tearOff())); + v->addWidget(tearoffwidget_); + v->addLayout(layout_); } @@ -141,15 +123,31 @@ } +void
Re: Empty Math Panel Popups
in summary: - allow panels to tear off using only qt 4.1 functionality - reported to work on windows, linux and mac seeking 2 ok's works for me with latest svn, qt4.3.0 and mac os x. andi
Fwd: r18833 - in /lyx-devel/trunk/development/Win32/packaging/...
To fix bug 3813, I have copied dictionary files to http://www.lyx.org/~bpeng/aspell6-windows; and make it an alternative downloading URL. The installer seems to work now. If there is a better location, I can change this URL. Cheers, Bo -- Forwarded message -- Author: bpeng Date: Tue Jun 19 21:29:36 2007 New Revision: 18833 URL: http://www.lyx.org/trac/changeset/18833 Log: Add an alternative aspell dict repository, fix bug 3813 Modified: lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh Modified: lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh URL: http://www.lyx.org/trac/file/lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh?rev=18833 == --- lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh (original) +++ lyx-devel/trunk/development/Win32/packaging/installer/components/dicts.nsh Tue Jun 19 21:29:36 2007 @@ -109,7 +109,13 @@ Pop $R3 ${if} $R3 != "OK" - #Download failed + #Download failed, try an alternative link + InetLoad::load "${ALT_DOWNLOAD_ASPELLDICTS}/aspell6-$R0.exe" "$PLUGINSDIR\aspell6-$R0.exe" /END + Pop $R3 +${endif} + +${if} $R3 != "OK" + #Download failed again MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_DICT) ($R3)" IDYES dict_download Goto dict_noinstall ${endif} Modified: lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh URL: http://www.lyx.org/trac/file/lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh?rev=18833 == --- lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh (original) +++ lyx-devel/trunk/development/Win32/packaging/installer/settings.nsh Tue Jun 19 21:29:36 2007 @@ -35,6 +35,7 @@ !define DOWNLOAD_VIEWER "http://tug.ctan.org/tex-archive/nonfree/support/ghostscript/ghostgum/gsv48w32.exe; !define DOWNLOAD_ASPELLDICTS "ftp://ftp.lyx.org/pub/lyx/contrib/aspell6-windows; +!define ALT_DOWNLOAD_ASPELLDICTS "http://www.lyx.org/~bpeng/aspell6-windows; # #Download size (in KB)