two patches from John, and a moving math panel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2983 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-11-08 11:46:06 +00:00
parent a1a47b2255
commit fcee90ebd5
9 changed files with 52 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2001-11-08 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* ui/default.ui: move math panel from Edit to Insert.
2001-11-05 Kayvan A. Sylvan <kayvan@sylvan.com> 2001-11-05 Kayvan A. Sylvan <kayvan@sylvan.com>
* layouts/chess.layout: * layouts/chess.layout:

View File

@ -96,7 +96,6 @@ Menuset
Item "Find & Replace...|F" "find-replace" Item "Find & Replace...|F" "find-replace"
Submenu "Tabular|T" "edit_tabular" Submenu "Tabular|T" "edit_tabular"
Submenu "Floats & Insets|I" "edit_floats" Submenu "Floats & Insets|I" "edit_floats"
Item "Math Panel|l" "math-panel"
Submenu "Math|M" "edit_math" Submenu "Math|M" "edit_math"
Separator Separator
#Item "Read Only" "buffer-toggle-read-only" #Item "Read Only" "buffer-toggle-read-only"
@ -185,6 +184,7 @@ Menuset
Menu "insert" Menu "insert"
Item "Math Formula|h" "math-mode" Item "Math Formula|h" "math-mode"
Item "Display Formula|D" "math-display" Item "Display Formula|D" "math-display"
Item "Math Panel|l" "math-panel"
#Item "Display Formula|D" "math-mode display" #Item "Display Formula|D" "math-mode display"
#Item "Change to Inline Math Formula|q" "math-mutate simple" #Item "Change to Inline Math Formula|q" "math-mutate simple"
#Item "Change to Displayed Math Formula|q" "math-mutate equation" #Item "Change to Displayed Math Formula|q" "math-mutate equation"

View File

@ -1,3 +1,13 @@
2001-11-07 John Levon <moz@compsoc.man.ac.uk>
* minibuffer.h:
* minibuffer.C: fix crash, improve drop-down completion
2001-11-06 John Levon <moz@compsoc.man.ac.uk>
* lyxserver.h:
* lyxserver.C: invalidate fd's when doing endPipe()
2001-11-08 José Matos <jamatos@fep.up.pt> 2001-11-08 José Matos <jamatos@fep.up.pt>
* buffer.C (sgmlLineBreak): renamed from linux_doc_line_break. * buffer.C (sgmlLineBreak): renamed from linux_doc_line_break.

View File

@ -1,3 +1,7 @@
2001-11-07 John Levon <moz@compsoc.man.ac.uk>
* DropDown.C: fix crash, improve behaviour a bit
2001-11-07 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-11-07 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* FormDocument.C (class_apply): * FormDocument.C (class_apply):

View File

@ -100,6 +100,7 @@ int DropDown::peek(XEvent * xev)
fl_hide_form(form_); fl_hide_form(form_);
return 1; return 1;
} }
XUngrabPointer(fl_get_display(), CurrentTime);
} else if (xev->type == KeyPress) { } else if (xev->type == KeyPress) {
char s_r[10]; s_r[9] = '\0'; char s_r[10]; s_r[9] = '\0';
KeySym keysym_return; KeySym keysym_return;
@ -114,6 +115,18 @@ int DropDown::peek(XEvent * xev)
case XK_Return: case XK_Return:
completed(); completed();
return 1; return 1;
case XK_Escape:
fl_select_browser_line(browser_, 0);
completed();
return 1;
default:
// FIXME: if someone has a got a way to
// convince the event to fall back to the
// minibuffer, I'm glad to hear it.
// fl_XPutBackEvent() doesn't work.
fl_select_browser_line(browser_, 0);
completed();
return 1;
} }
} }
return 0; return 0;
@ -122,9 +135,10 @@ int DropDown::peek(XEvent * xev)
void DropDown::completed() void DropDown::completed()
{ {
XUngrabPointer(fl_get_display(), CurrentTime);
string selection; string selection;
int i = fl_get_browser(browser_); int i = fl_get_browser(browser_);
if (i == -1) if (i < 1)
selection = ""; selection = "";
else else
selection = fl_get_browser_line(browser_, i); selection = fl_get_browser_line(browser_, i);

View File

@ -215,7 +215,7 @@ int LyXComm::startPipe(string const & filename)
} }
void LyXComm::endPipe(int fd, string const & filename) void LyXComm::endPipe(int & fd, string const & filename)
{ {
if (fd < 0) if (fd < 0)
return; return;
@ -245,6 +245,8 @@ void LyXComm::endPipe(int fd, string const & filename)
<< '\n' << strerror(errno) << endl; << '\n' << strerror(errno) << endl;
}; };
#endif #endif
fd = -1;
} }

View File

@ -69,7 +69,7 @@ private:
int startPipe(string const &); int startPipe(string const &);
/// finish a pipe /// finish a pipe
void endPipe(int, string const &); void endPipe(int &, string const &);
/// This is -1 if not open /// This is -1 if not open
int infd; int infd;

View File

@ -70,7 +70,7 @@ MiniBuffer::MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y,
void MiniBuffer::dd_init() void MiniBuffer::dd_init()
{ {
dropdown_ = new DropDown(owner_, the_buffer); dropdown_ = new DropDown(owner_, the_buffer);
dropdown_->result.connect(slot(this, &MiniBuffer::set_input)); dropdown_->result.connect(slot(this, &MiniBuffer::set_complete_input));
} }
@ -153,14 +153,15 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
// Perfect match // Perfect match
string const tmp = string const tmp =
comp[0] + _(" [sole completion]"); comp[0] + _(" [sole completion]");
stored_set(comp[0]); stored_set(comp[0] + " ");
set_input(tmp); set_input(tmp);
} else { } else {
// More that one match // More that one match
// Find maximal avaliable prefix // Find maximal avaliable prefix
string const tmp = comp[0]; string const tmp = comp[0];
string test(input); string test(input);
test += tmp[test.length()]; if (tmp.length() > test.length())
test += tmp[test.length()];
while (test.length() < tmp.length()) { while (test.length() < tmp.length()) {
vector<string> vtmp; vector<string> vtmp;
lyx::copy_if(comp.begin(), lyx::copy_if(comp.begin(),
@ -378,6 +379,13 @@ void MiniBuffer::redraw()
} }
void MiniBuffer::set_complete_input(string const & str)
{
if (!str.empty())
set_input(str);
}
void MiniBuffer::set_input(string const & str) void MiniBuffer::set_input(string const & str)
{ {
fl_set_input(the_buffer, str.c_str()); fl_set_input(the_buffer, str.c_str());

View File

@ -74,7 +74,9 @@ private:
void stored_slot(); void stored_slot();
/// ///
void stored_set(string const &); void stored_set(string const &);
/// /// set the minibuffer content if str non-empty
void set_complete_input(string const &);
/// set the minibuffer content
void set_input(string const &); void set_input(string const &);
/// ///
void init(); void init();