mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
the rest read the ChangeLog, hope I remembered all
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1934 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
998cee223a
commit
b17500c1c4
@ -22,7 +22,6 @@
|
||||
#include "insets/insetinfo.h"
|
||||
#include "insets/insetspecialchar.h"
|
||||
#include "LyXView.h"
|
||||
#include "minibuffer.h"
|
||||
#include "bufferlist.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "lyxscreen.h"
|
||||
@ -33,6 +32,8 @@
|
||||
#include "insets/insetcommand.h" //ChangeRefs
|
||||
#include "support/lyxfunctional.h" //equal_1st_in_pair
|
||||
#include "language.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
extern BufferList bufferlist;
|
||||
|
||||
@ -424,7 +425,8 @@ void BufferView::insertNote()
|
||||
void BufferView::openStuff()
|
||||
{
|
||||
if (available()) {
|
||||
owner()->getMiniBuffer()->Set(_("Open/Close..."));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Open/Close..."));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
@ -438,7 +440,8 @@ void BufferView::openStuff()
|
||||
void BufferView::toggleFloat()
|
||||
{
|
||||
if (available()) {
|
||||
owner()->getMiniBuffer()->Set(_("Open/Close..."));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Open/Close..."));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
@ -452,12 +455,13 @@ void BufferView::toggleFloat()
|
||||
void BufferView::menuUndo()
|
||||
{
|
||||
if (available()) {
|
||||
owner()->getMiniBuffer()->Set(_("Undo"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Undo"));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
if (!text->TextUndo(this))
|
||||
owner()->getMiniBuffer()->Set(_("No further undo information"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("No forther undo information"));
|
||||
else
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
setState();
|
||||
@ -468,17 +472,20 @@ void BufferView::menuUndo()
|
||||
void BufferView::menuRedo()
|
||||
{
|
||||
if (theLockingInset()) {
|
||||
owner()->getMiniBuffer()->Set(_("Redo not yet supported in math mode"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Redo not yet supported in math mode"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (available()) {
|
||||
owner()->getMiniBuffer()->Set(_("Redo"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Redo"));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
if (!text->TextRedo(this))
|
||||
owner()->getMiniBuffer()->Set(_("No further redo information"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("No further redo information"));
|
||||
else
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
setState();
|
||||
@ -570,6 +577,7 @@ void BufferView::hfill()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BufferView::copyEnvironment()
|
||||
{
|
||||
if (available()) {
|
||||
@ -578,7 +586,8 @@ void BufferView::copyEnvironment()
|
||||
toggleSelection();
|
||||
text->ClearSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Paragraph environment type copied"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -587,7 +596,8 @@ void BufferView::pasteEnvironment()
|
||||
{
|
||||
if (available()) {
|
||||
text->pasteEnvironmentType(this);
|
||||
owner()->getMiniBuffer()->Set(_("Paragraph environment type set"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Paragraph environment type set"));
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
}
|
||||
@ -601,7 +611,7 @@ void BufferView::copy()
|
||||
toggleSelection();
|
||||
text->ClearSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
owner()->getMiniBuffer()->Set(_("Copy"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Copy"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +622,7 @@ void BufferView::cut()
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
text->CutSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
owner()->getMiniBuffer()->Set(_("Cut"));
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Cut"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -620,8 +630,9 @@ void BufferView::cut()
|
||||
void BufferView::paste()
|
||||
{
|
||||
if (!available()) return;
|
||||
|
||||
owner()->getMiniBuffer()->Set(_("Paste"));
|
||||
|
||||
owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Paste"));
|
||||
|
||||
hideCursor();
|
||||
// clear the selection
|
||||
toggleSelection();
|
||||
@ -666,10 +677,14 @@ void BufferView::gotoInset(std::vector<Inset::Code> const & codes,
|
||||
text->cursor.pos(0);
|
||||
if (!text->GotoNextInset(this, codes, contents)) {
|
||||
text->cursor = tmp;
|
||||
owner()->getMiniBuffer()->Set(_("No more insets"));
|
||||
owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("No more insets"));
|
||||
}
|
||||
} else {
|
||||
owner()->getMiniBuffer()->Set(_("No more insets"));
|
||||
owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("No more insets"));
|
||||
}
|
||||
}
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
@ -864,11 +879,6 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
|
||||
if (text->UpdateInset(this, inset)) {
|
||||
update();
|
||||
if (mark_dirty) {
|
||||
#if 0
|
||||
if (buffer()->isLyxClean())
|
||||
owner()->getMiniBuffer()->
|
||||
setTimer(4);
|
||||
#endif
|
||||
buffer()->markDirty();
|
||||
}
|
||||
updateScrollbar();
|
||||
@ -878,11 +888,6 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
|
||||
if (text->UpdateInset(this, theLockingInset())) {
|
||||
update();
|
||||
if (mark_dirty){
|
||||
#if 0
|
||||
if (buffer()->isLyxClean())
|
||||
owner()->getMiniBuffer()->
|
||||
setTimer(4);
|
||||
#endif
|
||||
buffer()->markDirty();
|
||||
}
|
||||
updateScrollbar();
|
||||
@ -906,7 +911,8 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::ChangeInsets(Inset::Code code, string const & from, string const & to)
|
||||
bool BufferView::ChangeInsets(Inset::Code code,
|
||||
string const & from, string const & to)
|
||||
{
|
||||
bool flag = false;
|
||||
LyXParagraph * par = buffer()->paragraph;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "LyXView.h"
|
||||
#include "commandtags.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "minibuffer.h"
|
||||
#include "font.h"
|
||||
#include "bufferview_funcs.h"
|
||||
#include "TextCache.h"
|
||||
@ -56,6 +55,8 @@
|
||||
#include "insets/insettheorem.h"
|
||||
#include "insets/insetcaption.h"
|
||||
#include "mathed/formulamacro.h"
|
||||
#include "gettext.h"
|
||||
|
||||
extern LyXTextClass::size_type current_layout;
|
||||
extern int greek_kb_flag;
|
||||
|
||||
@ -222,7 +223,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
|
||||
}
|
||||
// should update layoutchoice even if we don't have a buffer.
|
||||
owner_->updateLayoutChoice();
|
||||
owner_->getMiniBuffer()->Init();
|
||||
|
||||
owner_->updateWindowTitle();
|
||||
}
|
||||
|
||||
@ -287,7 +288,8 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
|
||||
ProhibitInput(bv_);
|
||||
|
||||
owner_->getMiniBuffer()->Set(_("Formatting document..."));
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Formatting document..."));
|
||||
|
||||
if (bv_->text) {
|
||||
par = bv_->text->cursor.par();
|
||||
@ -344,7 +346,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
// this will scroll the screen such that the cursor becomes visible
|
||||
updateScrollbar();
|
||||
redraw();
|
||||
owner_->getMiniBuffer()->Init();
|
||||
|
||||
bv_->setState();
|
||||
AllowInput(bv_);
|
||||
|
||||
@ -359,8 +361,6 @@ void BufferView::Pimpl::updateScreen()
|
||||
{
|
||||
// Regenerate the screen.
|
||||
screen_.reset(new LyXScreen(workarea_));
|
||||
//delete screen_;
|
||||
//screen_ = new LyXScreen(workarea_);
|
||||
}
|
||||
|
||||
|
||||
@ -634,7 +634,8 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
||||
UpdatableInset * inset = static_cast<UpdatableInset *>(inset_hit);
|
||||
selection_possible = false;
|
||||
owner_->updateLayoutChoice();
|
||||
owner_->getMiniBuffer()->Set(inset->EditMessage());
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
inset->EditMessage());
|
||||
inset->InsetButtonPress(bv_, xpos, ypos, button);
|
||||
inset->Edit(bv_, xpos, ypos, button);
|
||||
return;
|
||||
@ -796,7 +797,9 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
||||
bv_->text->SetCursorParUndo(bv_->buffer());
|
||||
}
|
||||
|
||||
owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
inset_hit->EditMessage());
|
||||
|
||||
if (inset_hit->Editable()==Inset::HIGHLY_EDITABLE) {
|
||||
// Highly editable inset, like math
|
||||
UpdatableInset *inset = (UpdatableInset *)inset_hit;
|
||||
@ -1019,9 +1022,6 @@ void BufferView::Pimpl::workAreaExpose()
|
||||
|
||||
// The main window size has changed, repaint most stuff
|
||||
redraw();
|
||||
// ...including the minibuffer
|
||||
owner_->getMiniBuffer()->Init();
|
||||
|
||||
} else if (screen_.get())
|
||||
screen_->Redraw(bv_->text, bv_);
|
||||
} else {
|
||||
@ -1100,14 +1100,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
|
||||
}
|
||||
|
||||
if ((f & CHANGE)) {
|
||||
if (buffer_->isLyxClean()) {
|
||||
buffer_->markDirty();
|
||||
#if 0
|
||||
owner_->getMiniBuffer()->setTimer(4);
|
||||
#endif
|
||||
} else {
|
||||
buffer_->markDirty();
|
||||
}
|
||||
buffer_->markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1218,8 +1211,10 @@ void BufferView::Pimpl::savePosition(unsigned int i)
|
||||
saved_positions[i] = Position(buffer_->fileName(),
|
||||
bv_->text->cursor.par()->id(),
|
||||
bv_->text->cursor.pos());
|
||||
if (i > 0)
|
||||
owner_->getMiniBuffer()->Set(_("Saved bookmark"), tostr(i));
|
||||
if (i > 0) {
|
||||
string const str = _("Saved bookmark") + ' ' + tostr(i);
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1251,8 +1246,10 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
|
||||
min(par->size(), saved_positions[i].par_pos));
|
||||
#endif
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
if (i > 0)
|
||||
owner_->getMiniBuffer()->Set(_("Moved to bookmark"), tostr(i));
|
||||
if (i > 0) {
|
||||
string const str = _("Moved to bookmark") + ' ' + tostr(i);
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1470,7 +1467,8 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
|
||||
|
||||
// check selected filename
|
||||
if (filename.empty()) {
|
||||
owner_->getMiniBuffer()->Set(_("Canceled."));
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Canceled."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1482,16 +1480,18 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
|
||||
filename += ".lyx";
|
||||
|
||||
// Inserts document
|
||||
owner_->getMiniBuffer()->Set(_("Inserting document"),
|
||||
MakeDisplayPath(filename), "...");
|
||||
string const s1 = _("Inserting document") + ' '
|
||||
+ MakeDisplayPath(filename) + " ...";
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, s1);
|
||||
bool const res = bv_->insertLyXFile(filename);
|
||||
if (res) {
|
||||
owner_->getMiniBuffer()->Set(_("Document"),
|
||||
MakeDisplayPath(filename),
|
||||
_("inserted."));
|
||||
string const str = _("Document") + ' '
|
||||
+ MakeDisplayPath(filename) + ' ' + _("inserted.");
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str);
|
||||
} else {
|
||||
owner_->getMiniBuffer()->Set(_("Could not insert document"),
|
||||
MakeDisplayPath(filename));
|
||||
string const str = _("Could not insert document") + ' '
|
||||
+ MakeDisplayPath(filename);
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,84 @@
|
||||
2001-04-17 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* minibuffer.[Ch]: reimplement so that commands is initiated and
|
||||
run from lyxfunc, simplified som handling, and made the completion
|
||||
and history code for complete. wip.
|
||||
|
||||
* lyxfunc.C (processKeySym): call message
|
||||
(miniDispatch): new temporary method
|
||||
(LFUN_EXEC_COMMAND): reimplement for new minibuffer
|
||||
(LFUN_MESSAGE): implement
|
||||
(LFUN_MESSAGE_PUSH): implement
|
||||
(LFUN_MESSAGE_POP): implement
|
||||
(initMiniBuffer): the initial/defualt minibuffer message.
|
||||
|
||||
* lyxfont.[Ch]: inline some more getters
|
||||
|
||||
* lyx_gui_misc.C (WriteAlert): use LFUN_MESSAGE
|
||||
|
||||
* lyx_gui_misc.[Ch] (WriteStatus): remove method
|
||||
|
||||
* lyx_cb.[Ch] (ShowMessage): remove delay arg, use LFUN_MESSAGE
|
||||
(AutoSave): use LFUN_MESSAGE
|
||||
(Reconfigure): ditto
|
||||
|
||||
* importer.C (Import): constify som local vars, use LFUN_MESSAGE
|
||||
|
||||
* figureForm.C: use LFUN_MESSAGE
|
||||
|
||||
* converter.C (runLaTeX): use LFUN_MESSAGE
|
||||
|
||||
* bufferview_funcs.C: use LFUN_MESSAGE
|
||||
(Melt): ditto
|
||||
(changeDepth): ditto
|
||||
|
||||
* bufferparams.h: use boost::
|
||||
|
||||
* bufferlist.h: inherit privately from noncopyable
|
||||
|
||||
* bufferlist.C (loadLyXFile): remove some commented code.
|
||||
|
||||
* buffer.C (runChktex): use LFUN_MESSAGE
|
||||
|
||||
* ShareContainer.h: inherit privately from noncopyable
|
||||
|
||||
* ParagraphParameters.[hC] (depth): inline it.
|
||||
|
||||
* LyXView.[Ch] (LyXView): connect the minibuffer signals to lyxfunc
|
||||
methods.
|
||||
(message): new method
|
||||
(messagePush): ditto
|
||||
(messagePop): ditto
|
||||
(show): init minibuffer
|
||||
(showState): direct call
|
||||
|
||||
* LaTeX.[Ch]: inherit privately from noncopyable
|
||||
(run): change second arg to LyXFunc*, use LFUN_MESSAGE
|
||||
instead of WriteStatus.
|
||||
|
||||
* FontLoader.C (doLoad): use LFUN_MESSAGE_PUSH and LFUN_MESSAGE_POP
|
||||
|
||||
* BufferView_pimpl.C (buffer): don't init minibuffer
|
||||
(workAreaButtonPress): use LFUN_MESSAGE
|
||||
(workAreaButtonRelease): ditto
|
||||
(savePosition): ditto
|
||||
(restorePosition): ditto
|
||||
(MenuInsertLyXFile): ditto
|
||||
(workAreaExpose): don't init minibuffer
|
||||
(update): remove commented code, simplify
|
||||
|
||||
* BufferView2.C (openStuff): use LFUN_MESSAGE
|
||||
(toggleFloat): ditto
|
||||
(menuUndo): ditto
|
||||
(menuRedo): ditto
|
||||
(copyEnvironment): ditto
|
||||
(pasteEnvironment): ditto
|
||||
(copy): ditto
|
||||
(cut): ditto
|
||||
(paste): ditto
|
||||
(gotoInset): ditto
|
||||
(updateInset): remove some commented code
|
||||
|
||||
* lastfiles.h: inherit privately from noncopyable
|
||||
* layout.h: ditto
|
||||
* lyx_gui.h: ditto
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "lyxrc.h" // lyxrc.font_*
|
||||
#include "BufferView.h"
|
||||
#include "LyXView.h"
|
||||
#include "minibuffer.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
@ -246,8 +246,10 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||
|
||||
XFontStruct * fs = 0;
|
||||
|
||||
current_view->owner()->getMiniBuffer()->Store();
|
||||
current_view->owner()->getMiniBuffer()->Set(_("Loading font into X-Server..."));
|
||||
current_view->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE_PUSH,
|
||||
_("Loading font into X-Server..."));
|
||||
|
||||
fs = XLoadQueryFont(fl_get_display(), font.c_str());
|
||||
|
||||
if (fs == 0) {
|
||||
@ -274,7 +276,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||
<< "' matched by\n" << font << endl;
|
||||
}
|
||||
|
||||
current_view->owner()->getMiniBuffer()->Reset();
|
||||
current_view->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE_POP);
|
||||
|
||||
fontstruct[family][series][shape][size] = fs;
|
||||
return fs;
|
||||
|
27
src/LaTeX.C
27
src/LaTeX.C
@ -29,9 +29,9 @@
|
||||
#include "support/LRegex.h"
|
||||
#include "support/LSubstring.h"
|
||||
#include "bufferlist.h"
|
||||
#include "minibuffer.h"
|
||||
#include "gettext.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using std::ifstream;
|
||||
using std::getline;
|
||||
@ -106,7 +106,7 @@ void LaTeX::deleteFilesOnError() const
|
||||
}
|
||||
|
||||
|
||||
int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||
int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
|
||||
// We know that this function will only be run if the lyx buffer
|
||||
// has been changed. We also know that a newly written .tex file
|
||||
// is always different from the previous one because of the date
|
||||
@ -173,8 +173,10 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||
bibtex_info_old = scanAuxFiles(aux_file);
|
||||
|
||||
++count;
|
||||
lyxerr[Debug::LATEX] << "Run #" << count << endl;
|
||||
WriteStatus(minib, string(_("LaTeX run number ")) + tostr(count));
|
||||
lyxerr[Debug::LATEX] << "Run #" << count << endl;
|
||||
lfun->Dispatch(LFUN_MESSAGE, _("LaTeX run number") + ' ' + tostr(count));
|
||||
|
||||
//WriteStatus(lfun, string(_("LaTeX run number ")) + tostr(count));
|
||||
this->operator()();
|
||||
scanres = scanLogFile(terr);
|
||||
if (scanres & ERROR_RERUN) {
|
||||
@ -207,7 +209,8 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||
if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
|
||||
// no checks for now
|
||||
lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
|
||||
WriteStatus(minib, _("Running MakeIndex."));
|
||||
lfun->Dispatch(LFUN_MESSAGE, _("Running MakeIndex."));
|
||||
// WriteStatus(minib, _("Running MakeIndex."));
|
||||
rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
|
||||
}
|
||||
|
||||
@ -219,7 +222,8 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||
// tags is found -> run bibtex and set rerun = true;
|
||||
// no checks for now
|
||||
lyxerr[Debug::LATEX] << "Running BibTeX." << endl;
|
||||
WriteStatus(minib, _("Running BibTeX."));
|
||||
lfun->Dispatch(LFUN_MESSAGE, _("Running BibTeX."));
|
||||
//WriteStatus(minib, _("Running BibTeX."));
|
||||
updateBibtexDependencies(head, bibtex_info);
|
||||
rerun |= runBibTeX(bibtex_info);
|
||||
} else if (!had_depfile)
|
||||
@ -247,8 +251,9 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||
<< "Dep. file has changed or rerun requested" << endl;
|
||||
lyxerr[Debug::LATEX]
|
||||
<< "Run #" << count << endl;
|
||||
WriteStatus(minib,
|
||||
string(_("LaTeX run number ")) + tostr(count));
|
||||
lfun->Dispatch(LFUN_MESSAGE, _("LaTeX run number") + ' ' + tostr(count));
|
||||
// WriteStatus(minib,
|
||||
// string(_("LaTeX run number ")) + tostr(count));
|
||||
this->operator()();
|
||||
scanres = scanLogFile(terr);
|
||||
if (scanres & ERRORS) {
|
||||
@ -275,7 +280,8 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||
if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
|
||||
// no checks for now
|
||||
lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
|
||||
WriteStatus(minib, _("Running MakeIndex."));
|
||||
lfun->Dispatch(LFUN_MESSAGE, _("Running MakeIndex."));
|
||||
//WriteStatus(minib, _("Running MakeIndex."));
|
||||
rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
|
||||
}
|
||||
|
||||
@ -296,7 +302,8 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||
rerun = false;
|
||||
++count;
|
||||
lyxerr[Debug::LATEX] << "Run #" << count << endl;
|
||||
WriteStatus(minib, string(_("LaTeX run number ")) + tostr(count));
|
||||
lfun->Dispatch(LFUN_MESSAGE, _("LaTeX run numger") + ' ' + tostr(count));
|
||||
// WriteStatus(minib, string(_("LaTeX run number ")) + tostr(count));
|
||||
this->operator()();
|
||||
scanres = scanLogFile(terr);
|
||||
if (scanres & ERRORS) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
class MiniBuffer;
|
||||
class LyXFunc;
|
||||
|
||||
///
|
||||
class TeXErrors {
|
||||
@ -97,7 +97,7 @@ bool operator!=(Aux_Info const & a, Aux_Info const & o)
|
||||
|
||||
|
||||
///
|
||||
class LaTeX : public boost::noncopyable {
|
||||
class LaTeX : boost::noncopyable {
|
||||
public:
|
||||
/** Return values from scanLogFile() and run() (to come)
|
||||
|
||||
@ -152,7 +152,7 @@ public:
|
||||
virtual ~LaTeX() {}
|
||||
|
||||
/// runs LaTeX several times
|
||||
int run(TeXErrors &, MiniBuffer *);
|
||||
int run(TeXErrors &, LyXFunc *);
|
||||
|
||||
///
|
||||
int getNumErrors() { return num_errors;}
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "ToolbarDefaults.h"
|
||||
#include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs
|
||||
#include "bufferview_funcs.h" // CurrentState()
|
||||
#include "gettext.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
@ -57,6 +58,13 @@ LyXView::LyXView(int width, int height)
|
||||
fl_set_form_atclose(form_, C_LyXView_atCloseMainFormCB, 0);
|
||||
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
|
||||
lyxfunc = new LyXFunc(this);
|
||||
|
||||
// Connect the minibuffer signals
|
||||
minibuffer->stringReady.connect(SigC::slot(lyxfunc,
|
||||
&LyXFunc::miniDispatch));
|
||||
minibuffer->timeout.connect(SigC::slot(lyxfunc,
|
||||
&LyXFunc::initMiniBuffer));
|
||||
|
||||
intl = new Intl;
|
||||
|
||||
// Make sure the buttons are disabled if needed.
|
||||
@ -90,7 +98,7 @@ LyXView::~LyXView()
|
||||
void LyXView::redraw() {
|
||||
lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
|
||||
fl_redraw_form(form_);
|
||||
minibuffer->Activate();
|
||||
minibuffer->redraw();
|
||||
}
|
||||
|
||||
|
||||
@ -144,6 +152,24 @@ MiniBuffer * LyXView::getMiniBuffer() const
|
||||
}
|
||||
|
||||
|
||||
void LyXView::message(string const & str)
|
||||
{
|
||||
minibuffer->message(str);
|
||||
}
|
||||
|
||||
|
||||
void LyXView::messagePush(string const & str)
|
||||
{
|
||||
minibuffer->messagePush(str);
|
||||
}
|
||||
|
||||
|
||||
void LyXView::messagePop()
|
||||
{
|
||||
minibuffer->messagePop();
|
||||
}
|
||||
|
||||
|
||||
Menubar * LyXView::getMenubar() const
|
||||
{
|
||||
return menubar;
|
||||
@ -208,7 +234,7 @@ void LyXView::setPosition(int x, int y)
|
||||
void LyXView::show(int place, int border, string const & title)
|
||||
{
|
||||
fl_show_form(form_, place, border, title.c_str());
|
||||
minibuffer->Init();
|
||||
lyxfunc->initMiniBuffer();
|
||||
#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
|
||||
InitLyXLookup(fl_get_display(), form_->window);
|
||||
#endif
|
||||
@ -358,7 +384,7 @@ void LyXView::updateWindowTitle()
|
||||
string title = "LyX";
|
||||
|
||||
if (view()->available()) {
|
||||
string cur_title = buffer()->fileName();
|
||||
string const cur_title = buffer()->fileName();
|
||||
if (!cur_title.empty()){
|
||||
title += ": " + MakeDisplayPath(cur_title, 30);
|
||||
if (!buffer()->isLyxClean())
|
||||
@ -377,7 +403,7 @@ void LyXView::updateWindowTitle()
|
||||
|
||||
void LyXView::showState()
|
||||
{
|
||||
getMiniBuffer()->Set(CurrentState(view()));
|
||||
message(CurrentState(view()));
|
||||
getToolbar()->update();
|
||||
menubar->update();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Dialogs;
|
||||
view is supposed (at least IMHO) to be another class, that shows its output
|
||||
in one or more LyXView's.
|
||||
*/
|
||||
class LyXView : public SigC::Object, public boost::noncopyable {
|
||||
class LyXView : public SigC::Object, boost::noncopyable {
|
||||
public:
|
||||
/// constructor
|
||||
LyXView(int w, int h);
|
||||
@ -83,6 +83,13 @@ public:
|
||||
/// return a pointer to the minibuffer
|
||||
MiniBuffer * getMiniBuffer() const;
|
||||
|
||||
///
|
||||
void message(string const &);
|
||||
///
|
||||
void messagePush(string const & str);
|
||||
///
|
||||
void messagePop();
|
||||
|
||||
///
|
||||
Menubar * getMenubar() const;
|
||||
|
||||
@ -101,7 +108,6 @@ public:
|
||||
/// Updates the title of the window
|
||||
void updateWindowTitle();
|
||||
|
||||
|
||||
/// Show state (toolbar and font in minibuffer)
|
||||
void showState();
|
||||
|
||||
|
@ -231,12 +231,6 @@ void ParagraphParameters::align(LyXAlignment la)
|
||||
}
|
||||
|
||||
|
||||
char ParagraphParameters::depth() const
|
||||
{
|
||||
return param->depth;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::depth(char d)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
|
@ -6,10 +6,11 @@
|
||||
#include "ShareContainer.h"
|
||||
#include "LString.h"
|
||||
#include "layout.h"
|
||||
#include "ParameterStruct.h"
|
||||
|
||||
class VSpace;
|
||||
class Spacing;
|
||||
struct ParameterStruct;
|
||||
|
||||
|
||||
// Not yet... lyx 1.3.x or so
|
||||
//#define NO_PEXTRA_REALLY 1
|
||||
@ -115,4 +116,11 @@ private:
|
||||
///
|
||||
static ShareContainer<ParameterStruct> container;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
char ParagraphParameters::depth() const
|
||||
{
|
||||
return param->depth;
|
||||
}
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@
|
||||
\author Lars Gullik Bjřnnes
|
||||
*/
|
||||
template<class Share>
|
||||
class ShareContainer : public boost::noncopyable {
|
||||
class ShareContainer : boost::noncopyable {
|
||||
public:
|
||||
///
|
||||
typedef std::vector<boost::shared_ptr<Share> > Params;
|
||||
|
@ -78,7 +78,9 @@ void ToolbarDefaults::init()
|
||||
|
||||
add(LFUN_FIGURE);
|
||||
add(LFUN_DIALOG_TABULAR_INSERT);
|
||||
#if 0
|
||||
//add(LFUN_MELT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "tex-strings.h"
|
||||
#include "layout.h"
|
||||
#include "bufferview_funcs.h"
|
||||
#include "minibuffer.h"
|
||||
#include "lyxfont.h"
|
||||
#include "version.h"
|
||||
#include "mathed/formulamacro.h"
|
||||
@ -3483,7 +3482,8 @@ int Buffer::runChktex()
|
||||
}
|
||||
|
||||
Path p(path); // path to LaTeX file
|
||||
users->owner()->getMiniBuffer()->Set(_("Running chktex..."));
|
||||
users->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Running chktex..."));
|
||||
|
||||
// Remove all error insets
|
||||
bool const removedErrorInsets = users->removeAutoInsets();
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "bufferlist.h"
|
||||
#include "lyx_main.h"
|
||||
#include "minibuffer.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lyxmanip.h"
|
||||
@ -491,11 +490,6 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
|
||||
bool ro = false;
|
||||
switch (IsFileWriteable(s)) {
|
||||
case 0:
|
||||
#if 0
|
||||
current_view->owner()->getMiniBuffer()->
|
||||
Set(_("File `") + MakeDisplayPath(s, 50) +
|
||||
_("' is read-only."));
|
||||
#endif
|
||||
ro = true;
|
||||
// Fall through
|
||||
case 1:
|
||||
|
@ -30,7 +30,7 @@
|
||||
This class should ideally be enclosed inside class BufferList, but that
|
||||
gave me an "internal gcc error".
|
||||
*/
|
||||
class BufferStorage : public boost::noncopyable {
|
||||
class BufferStorage : boost::noncopyable {
|
||||
public:
|
||||
///
|
||||
typedef std::vector<Buffer *> Container;
|
||||
@ -68,7 +68,7 @@ private:
|
||||
|
||||
/** The class govern all open buffers.
|
||||
*/
|
||||
class BufferList : public boost::noncopyable {
|
||||
class BufferList : boost::noncopyable {
|
||||
public:
|
||||
///
|
||||
BufferList();
|
||||
|
@ -190,9 +190,9 @@ public:
|
||||
///
|
||||
string pagestyle;
|
||||
///
|
||||
array<Bullet, 4> temp_bullets;
|
||||
boost::array<Bullet, 4> temp_bullets;
|
||||
///
|
||||
array<Bullet, 4> user_defined_bullets;
|
||||
boost::array<Bullet, 4> user_defined_bullets;
|
||||
///
|
||||
void readPreamble(LyXLex &);
|
||||
///
|
||||
|
@ -21,11 +21,12 @@
|
||||
#include "lyxfont.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "lyxtext.h"
|
||||
#include "minibuffer.h"
|
||||
#include "buffer.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "language.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void Foot(BufferView * bv)
|
||||
@ -71,7 +72,7 @@ void Noun(BufferView * bv)
|
||||
void Margin(BufferView * bv)
|
||||
{
|
||||
if (bv->available()) {
|
||||
bv->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
|
||||
bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Inserting margin note...");
|
||||
bv->hideCursor();
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::MARGIN);
|
||||
@ -103,8 +104,8 @@ void Lang(BufferView * bv, string const & l)
|
||||
void Melt(BufferView * bv)
|
||||
{
|
||||
if (!bv->available()) return;
|
||||
|
||||
bv->owner()->getMiniBuffer()->Set(_("Melt"));
|
||||
|
||||
bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Melt"));
|
||||
bv->hideCursor();
|
||||
bv->beforeChange(bv->text);
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
@ -139,9 +140,10 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc)
|
||||
if (text->inset_owner)
|
||||
bv->updateInset((Inset *)text->inset_owner, true);
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
bv->owner()->getMiniBuffer()
|
||||
->Set(_("Changed environment depth"
|
||||
" (in possible range, maybe not)"));
|
||||
bv->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("Changed environment depth "
|
||||
"(in possible range, maybe not)"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,10 +25,11 @@
|
||||
#include "bufferview_funcs.h"
|
||||
#include "LaTeX.h"
|
||||
#include "LyXView.h"
|
||||
#include "minibuffer.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "lyx_cb.h" // ShowMessage()
|
||||
#include "support/lyxfunctional.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
using std::vector;
|
||||
using std::queue;
|
||||
@ -817,7 +818,8 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
||||
|
||||
if (bv) {
|
||||
ProhibitInput(bv);
|
||||
bv->owner()->getMiniBuffer()->Set(_("Running LaTeX..."));
|
||||
bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Running LaTeX..."));
|
||||
// Remove all error insets
|
||||
need_redraw = bv->removeAutoInsets();
|
||||
}
|
||||
@ -827,7 +829,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
||||
TeXErrors terr;
|
||||
LaTeX latex(command, name, buffer->filepath);
|
||||
int result = latex.run(terr,
|
||||
bv ? bv->owner()->getMiniBuffer() : 0);
|
||||
bv ? bv->owner()->getLyXFunc() : 0);
|
||||
|
||||
|
||||
if (bv) {
|
||||
|
@ -20,9 +20,10 @@
|
||||
#include "figure_form.h"
|
||||
#include "insets/figinset.h"
|
||||
#include "BufferView.h"
|
||||
#include "minibuffer.h"
|
||||
#include "lyxtext.h"
|
||||
#include "LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
extern FD_form_figure * fd_form_figure;
|
||||
extern BufferView * current_view;
|
||||
@ -49,12 +50,16 @@ void FigureApplyCB(FL_OBJECT *, long)
|
||||
Buffer * buffer = current_view->buffer();
|
||||
if (buffer->isReadonly()) // paranoia
|
||||
return;
|
||||
|
||||
current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
|
||||
|
||||
current_view->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("Inserting figure..."));
|
||||
if (fl_get_button(fd_form_figure->radio_inline)) {
|
||||
InsetFig * new_inset = new InsetFig(100, 20, *buffer);
|
||||
current_view->insertInset(new_inset);
|
||||
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
|
||||
current_view->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("Figure inserted"));
|
||||
new_inset->Edit(current_view, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
@ -114,7 +119,8 @@ void FigureApplyCB(FL_OBJECT *, long)
|
||||
current_view->insertInset(new_inset);
|
||||
new_inset->Edit(current_view, 0, 0, 0);
|
||||
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
|
||||
current_view->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Figure inserted"));
|
||||
current_view->text->UnFreezeUndo();
|
||||
current_view->setState();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
satisfy that request. Thus a dialog will have to "pull" the necessary
|
||||
details from the core of the program.
|
||||
*/
|
||||
class DialogBase : public SigC::Object, public boost::noncopyable
|
||||
class DialogBase : public SigC::Object, boost::noncopyable
|
||||
{
|
||||
public:
|
||||
/**@name Constructors and Deconstructors */
|
||||
|
@ -1,3 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
/*
|
||||
* emptytable.h
|
||||
* (C) 2000 LyX Team
|
||||
|
@ -1,3 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
/*
|
||||
* lengthentry.h
|
||||
* (C) 2001 LyX Team
|
||||
|
@ -20,10 +20,10 @@
|
||||
#include "converter.h"
|
||||
#include "LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "minibuffer.h"
|
||||
#include "bufferlist.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyx_gui_misc.h" //WriteAlert
|
||||
#include "gettext.h"
|
||||
|
||||
using std::vector;
|
||||
using std::find;
|
||||
@ -35,10 +35,11 @@ extern void InsertAsciiFile(BufferView *, string const &, bool);
|
||||
bool Importer::Import(LyXView * lv, string const & filename,
|
||||
string const & format)
|
||||
{
|
||||
string displaypath = MakeDisplayPath(filename);
|
||||
lv->getMiniBuffer()->Set(_("Importing"), displaypath, "...");
|
||||
string const displaypath = MakeDisplayPath(filename);
|
||||
string const s1 = _("Importing") + ' ' + displaypath + "...";
|
||||
lv->getLyXFunc()->Dispatch(LFUN_MESSAGE, s1);
|
||||
|
||||
string lyxfile = ChangeExtension(filename, ".lyx");
|
||||
string const lyxfile = ChangeExtension(filename, ".lyx");
|
||||
|
||||
string loader_format;
|
||||
vector<string> loaders = Loaders();
|
||||
@ -78,7 +79,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
|
||||
}
|
||||
|
||||
// we are done
|
||||
lv->getMiniBuffer()->Set(displaypath, _("imported."));
|
||||
lv->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("imported."));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
28
src/lyx_cb.C
28
src/lyx_cb.C
@ -26,13 +26,14 @@
|
||||
#include "LyXView.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxtext.h"
|
||||
#include "minibuffer.h"
|
||||
#include "frontends/FileDialog.h"
|
||||
#include "insets/insetlabel.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/path.h"
|
||||
#include "support/syscall.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
using std::vector;
|
||||
using std::ifstream;
|
||||
@ -112,12 +113,13 @@ void ToggleLockedInsetCursor(int x, int y, int asc, int desc);
|
||||
void ShowMessage(Buffer const * buf,
|
||||
string const & msg1,
|
||||
string const & msg2,
|
||||
string const & msg3, int delay)
|
||||
string const & msg3)
|
||||
{
|
||||
if (lyxrc.use_gui)
|
||||
buf->getUser()->owner()->getMiniBuffer()->Set(msg1, msg2,
|
||||
msg3, delay);
|
||||
else
|
||||
if (lyxrc.use_gui) {
|
||||
string const str = msg1 + ' ' + msg2 + ' ' + msg3;
|
||||
buf->getUser()->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
str);
|
||||
} else
|
||||
lyxerr << msg1 << msg2 << msg3 << endl;
|
||||
}
|
||||
|
||||
@ -315,7 +317,9 @@ void AutoSave(BufferView * bv)
|
||||
return;
|
||||
}
|
||||
|
||||
bv->owner()->getMiniBuffer()->Set(_("Autosaving current document..."));
|
||||
bv->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("Autosaving current document..."));
|
||||
|
||||
// create autosave filename
|
||||
string fname = OnlyPath(bv->buffer()->fileName());
|
||||
@ -355,7 +359,9 @@ void AutoSave(BufferView * bv)
|
||||
// It is dangerous to do this in the child,
|
||||
// but safe in the parent, so...
|
||||
if (pid == -1)
|
||||
bv->owner()->getMiniBuffer()->Set(_("Autosave Failed!"));
|
||||
bv->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("Autosave Failed!"));
|
||||
}
|
||||
}
|
||||
if (pid == 0) { // we are the child so...
|
||||
@ -567,14 +573,16 @@ void MenuLayoutSave(BufferView * bv)
|
||||
// reconfigure the automatic settings.
|
||||
void Reconfigure(BufferView * bv)
|
||||
{
|
||||
bv->owner()->getMiniBuffer()->Set(_("Running configure..."));
|
||||
bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Running configure..."));
|
||||
|
||||
// Run configure in user lyx directory
|
||||
Path p(user_lyxdir);
|
||||
Systemcalls one(Systemcalls::System,
|
||||
AddName(system_lyxdir, "configure"));
|
||||
p.pop();
|
||||
bv->owner()->getMiniBuffer()->Set(_("Reloading configuration..."));
|
||||
bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
|
||||
_("Reloading configuration..."));
|
||||
lyxrc.read(LibFileSearch(string(), "lyxrc.defaults"));
|
||||
WriteAlert(_("The system has been reconfigured."),
|
||||
_("You need to restart LyX to make use of any"),
|
||||
|
@ -14,7 +14,7 @@ extern bool quitting;
|
||||
void ShowMessage(Buffer const * buf,
|
||||
string const & msg1,
|
||||
string const & msg2 = string(),
|
||||
string const & msg3 = string(), int delay = 6);
|
||||
string const & msg3 = string());
|
||||
///
|
||||
bool MenuWrite(BufferView * bv, Buffer * buffer);
|
||||
/// write the given file, or ask if no name given
|
||||
|
@ -23,13 +23,13 @@
|
||||
#include "figure_form.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "lyx_main.h"
|
||||
#include "minibuffer.h"
|
||||
#include "print_form.h"
|
||||
#include "sp_form.h"
|
||||
#include "LyXView.h"
|
||||
#include "bufferview_funcs.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
@ -136,26 +136,17 @@ char const * flyx_ident_extract(char const * sc)
|
||||
}
|
||||
|
||||
|
||||
void WriteStatus(MiniBuffer * minib, string const & s)
|
||||
{
|
||||
if (minib) {
|
||||
minib->Set(s);
|
||||
minib->Store();
|
||||
} else
|
||||
lyxerr << s << endl;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
void WriteAlert(string const & s1, string const & s2, string const & s3)
|
||||
{
|
||||
MiniBuffer * minibuffer = 0;
|
||||
LyXFunc * lfun = 0;
|
||||
if (current_view && current_view->owner())
|
||||
minibuffer = current_view->owner()->getMiniBuffer();
|
||||
if (minibuffer) {
|
||||
lfun = current_view->owner()->getLyXFunc();
|
||||
if (lfun) {
|
||||
/// Write to minibuffer
|
||||
ProhibitInput(current_view);
|
||||
minibuffer->Set(s1, s2, s3);
|
||||
string const msg = s1 + ' ' + s2 + ' ' + s3;
|
||||
lfun->Dispatch(LFUN_MESSAGE, msg);
|
||||
fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
|
||||
fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
|
||||
AllowInput(current_view);
|
||||
|
@ -22,8 +22,6 @@
|
||||
#include "LString.h"
|
||||
#include <utility> /* needed for pair<> definition */
|
||||
|
||||
class MiniBuffer;
|
||||
|
||||
/// Prevents LyX from being killed when the close box is pressed in a popup.
|
||||
extern "C" int CancelCloseBoxCB(FL_FORM *, void *);
|
||||
|
||||
@ -49,9 +47,6 @@ char const * flyx_ident_extract(char const * sc);
|
||||
/// Shortcut for flyx_ident_extract
|
||||
#define idex flyx_ident_extract
|
||||
|
||||
/// Show status message
|
||||
void WriteStatus(MiniBuffer * minib, string const & s);
|
||||
|
||||
/// Show message
|
||||
void WriteAlert(string const & s1, string const & s2 = string(),
|
||||
string const & s3 = string());
|
||||
|
@ -7,20 +7,20 @@
|
||||
#include "lyxtext.h"
|
||||
#include "lyxfind.h"
|
||||
#include "LyXView.h"
|
||||
#include "minibuffer.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "support/textutils.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "gettext.h"
|
||||
|
||||
int LyXReplace(BufferView * bv,
|
||||
string const & searchstr,
|
||||
string const & replacestr,
|
||||
bool const & casesens,
|
||||
bool const & matchwrd,
|
||||
bool const & forward,
|
||||
bool const & replaceall)
|
||||
string const & searchstr,
|
||||
string const & replacestr,
|
||||
bool const & casesens,
|
||||
bool const & matchwrd,
|
||||
bool const & forward,
|
||||
bool const & replaceall)
|
||||
{
|
||||
int replace_count = 0;
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "gettext.h"
|
||||
#include "lyxfont.h"
|
||||
#include "language.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxlex.h"
|
||||
@ -156,11 +155,6 @@ bool LyXFont::FontBits::operator!=(LyXFont::FontBits const & fb1) const
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont()
|
||||
: bits(sane), lang(default_language)
|
||||
{}
|
||||
|
||||
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT1)
|
||||
: bits(inherit), lang(default_language)
|
||||
{}
|
||||
@ -191,36 +185,12 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
|
||||
{}
|
||||
|
||||
|
||||
LyXFont::FONT_FAMILY LyXFont::family() const
|
||||
{
|
||||
return bits.family;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_SERIES LyXFont::series() const
|
||||
{
|
||||
return bits.series;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_SIZE LyXFont::size() const
|
||||
{
|
||||
return bits.size;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::underbar() const
|
||||
{
|
||||
return bits.underbar;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::noun() const
|
||||
{
|
||||
return bits.noun;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::latex() const
|
||||
{
|
||||
return bits.latex;
|
||||
|
@ -20,10 +20,11 @@
|
||||
|
||||
#include "LString.h"
|
||||
#include "LColor.h"
|
||||
#include "language.h"
|
||||
|
||||
class LyXLex;
|
||||
class BufferParams;
|
||||
class Language;
|
||||
|
||||
|
||||
///
|
||||
class LyXFont {
|
||||
@ -363,6 +364,33 @@ LyXFont::FONT_SHAPE LyXFont::shape() const
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont()
|
||||
: bits(sane), lang(default_language)
|
||||
{}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_FAMILY LyXFont::family() const
|
||||
{
|
||||
return bits.family;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_SERIES LyXFont::series() const
|
||||
{
|
||||
return bits.series;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_SIZE LyXFont::size() const
|
||||
{
|
||||
return bits.size;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_MISC_STATE LyXFont::emph() const
|
||||
{
|
||||
@ -370,6 +398,13 @@ LyXFont::FONT_MISC_STATE LyXFont::emph() const
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_MISC_STATE LyXFont::noun() const
|
||||
{
|
||||
return bits.noun;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE);
|
||||
|
||||
|
283
src/lyxfunc.C
283
src/lyxfunc.C
@ -25,6 +25,7 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "support/lyxalgo.h"
|
||||
#include "version.h"
|
||||
#include "kbmap.h"
|
||||
#include "lyxfunc.h"
|
||||
@ -112,10 +113,46 @@ extern LyXTextClass::size_type current_layout;
|
||||
|
||||
extern void ShowLatexLog();
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
///
|
||||
class MiniBufferController : public SigC::Object {
|
||||
public:
|
||||
///
|
||||
MiniBufferController() {
|
||||
minibuffer
|
||||
.cmdReady
|
||||
.connect(slot(this,
|
||||
&MiniBufferController::receiveCommand));
|
||||
minibuffer
|
||||
.argReady
|
||||
.connect(slot(this,
|
||||
&MiniBufferController::receiveArg));
|
||||
}
|
||||
///
|
||||
void receiveCmd(string const & cmd) {}
|
||||
///
|
||||
void receiveArg(string const & arg) {}
|
||||
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
MiniBufferController mb_ctrl;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* === globals =========================================================== */
|
||||
|
||||
// Initialization of static member var
|
||||
bool LyXFunc::show_sc = true;
|
||||
|
||||
|
||||
LyXFunc::LyXFunc(LyXView * o)
|
||||
: owner(o)
|
||||
{
|
||||
@ -125,14 +162,16 @@ LyXFunc::LyXFunc(LyXView * o)
|
||||
setupLocalKeymap();
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXText * LyXFunc::TEXT(bool flag=true) const
|
||||
LyXText * LyXFunc::TEXT(bool flag = true) const
|
||||
{
|
||||
if (flag)
|
||||
return owner->view()->text;
|
||||
return owner->view()->getLyXText();
|
||||
}
|
||||
|
||||
|
||||
// I changed this func slightly. I commented out the ...FinishUndo(),
|
||||
// this means that all places that used to have a moveCursorUpdate, now
|
||||
// have a ...FinishUndo() as the preceeding statement. I have also added
|
||||
@ -208,7 +247,8 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
|
||||
owner->showState();
|
||||
} else {
|
||||
tli->UnlockInsetInInset(owner->view(),
|
||||
tli->GetLockingInset(),true);
|
||||
tli->GetLockingInset(),
|
||||
true);
|
||||
}
|
||||
//return 0;
|
||||
return FL_PREEMPT;
|
||||
@ -239,7 +279,8 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
|
||||
// Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
|
||||
if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
|
||||
if (lyxerr.debugging(Debug::KEY)) {
|
||||
lyxerr << "meta_fake_bit is [" << meta_fake_bit << "]" << endl;
|
||||
lyxerr << "meta_fake_bit is ["
|
||||
<< meta_fake_bit << "]" << endl;
|
||||
}
|
||||
// remove Caps Lock and Mod2 as a modifiers
|
||||
action = keyseq.addkey(keysym,
|
||||
@ -247,7 +288,8 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
|
||||
&(ShiftMask|ControlMask
|
||||
|Mod1Mask));
|
||||
if (lyxerr.debugging(Debug::KEY)) {
|
||||
lyxerr << "action now set to [" << action << "]" << endl;
|
||||
lyxerr << "action now set to ["
|
||||
<< action << "]" << endl;
|
||||
}
|
||||
}
|
||||
// Dont remove this unless you know what you are doing.
|
||||
@ -271,14 +313,14 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
|
||||
if (keyseq.length > 1 || keyseq.length < -1) {
|
||||
string buf;
|
||||
keyseq.print(buf);
|
||||
owner->getMiniBuffer()->Set(buf);
|
||||
owner->message(buf);
|
||||
}
|
||||
|
||||
if (action == -1) {
|
||||
if (keyseq.length < -1) { // unknown key sequence...
|
||||
string buf;
|
||||
keyseq.print(buf);
|
||||
owner->getMiniBuffer()->Set(_("Unknown sequence:"), buf);
|
||||
owner->message(_("Unknown sequence:") + ' ' + buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -335,12 +377,15 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
||||
{
|
||||
return getStatus(ac, string());
|
||||
}
|
||||
|
||||
LyXFunc::func_status LyXFunc::getStatus(int ac, string const & not_to_use_arg) const
|
||||
|
||||
LyXFunc::func_status LyXFunc::getStatus(int ac,
|
||||
string const & not_to_use_arg) const
|
||||
{
|
||||
kb_action action;
|
||||
func_status flag = LyXFunc::OK;
|
||||
@ -411,8 +456,10 @@ LyXFunc::func_status LyXFunc::getStatus(int ac, string const & not_to_use_arg) c
|
||||
break;
|
||||
|
||||
case LFUN_INSERTFOOTNOTE:
|
||||
#if 0
|
||||
case LFUN_FOOTMELT:
|
||||
case LFUN_MARGINMELT:
|
||||
#endif
|
||||
// Disable insertion of floats in a tabular.
|
||||
disable = false;
|
||||
if (owner->view()->theLockingInset()) {
|
||||
@ -512,6 +559,12 @@ LyXFunc::func_status LyXFunc::getStatus(int ac, string const & not_to_use_arg) c
|
||||
}
|
||||
|
||||
|
||||
// temporary dispatch method
|
||||
void LyXFunc::miniDispatch(string const & s)
|
||||
{
|
||||
Dispatch(s);
|
||||
}
|
||||
|
||||
string const LyXFunc::Dispatch(string const & s)
|
||||
{
|
||||
// Split command string into command and argument
|
||||
@ -524,7 +577,7 @@ string const LyXFunc::Dispatch(string const & s)
|
||||
|
||||
|
||||
string const LyXFunc::Dispatch(int ac,
|
||||
string const & do_not_use_this_arg)
|
||||
string const & do_not_use_this_arg)
|
||||
{
|
||||
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << ac
|
||||
<<"] arg[" << do_not_use_this_arg << "]" << endl;
|
||||
@ -596,7 +649,8 @@ string const LyXFunc::Dispatch(int ac,
|
||||
if (!comname.empty()) {
|
||||
comname = strip(comname);
|
||||
commandshortcut = "(" + comname + ')';
|
||||
owner->getMiniBuffer()->Set(commandshortcut);
|
||||
owner->message(commandshortcut);
|
||||
|
||||
// Here we could even add a small pause,
|
||||
// to annoy the user and make him learn
|
||||
// the shortcuts.
|
||||
@ -747,14 +801,22 @@ string const LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
string buf;
|
||||
keyseq.print(buf, true);
|
||||
owner->getMiniBuffer()->Set(buf, string(), string(), 1);
|
||||
//owner->getMiniBuffer()->Set(buf, string(), string(), 1);
|
||||
owner->message(buf);
|
||||
}
|
||||
break;
|
||||
|
||||
// --- Misc -------------------------------------------
|
||||
case LFUN_EXEC_COMMAND:
|
||||
owner->getMiniBuffer()->PrepareForCommand();
|
||||
break;
|
||||
{
|
||||
vector<string> allCmds;
|
||||
transform(lyxaction.func_begin(), lyxaction.func_end(),
|
||||
back_inserter(allCmds), lyx::firster());
|
||||
static vector<string> hist;
|
||||
owner->getMiniBuffer()->getString(MiniBuffer::nospaces,
|
||||
allCmds, hist);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CANCEL: // RVDK_PATCH_5
|
||||
keyseq.reset();
|
||||
@ -802,9 +864,11 @@ string const LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_MENUWRITE:
|
||||
if (!owner->buffer()->isUnnamed()) {
|
||||
owner->getMiniBuffer()->Set(_("Saving document"),
|
||||
MakeDisplayPath(owner->buffer()->fileName()),
|
||||
"...");
|
||||
string const s1 = _("Saving document") + ' '
|
||||
+ MakeDisplayPath(owner->buffer()->fileName()
|
||||
+ "...");
|
||||
|
||||
owner->message(s1);
|
||||
MenuWrite(owner->view(), owner->buffer());
|
||||
} else
|
||||
WriteAs(owner->view(), owner->buffer());
|
||||
@ -1011,22 +1075,25 @@ string const LyXFunc::Dispatch(int ac,
|
||||
owner->getDialogs()->showCredits();
|
||||
break;
|
||||
|
||||
case LFUN_HELP_OPEN: {
|
||||
string arg = argument;
|
||||
case LFUN_HELP_OPEN:
|
||||
{
|
||||
string const arg = argument;
|
||||
if (arg.empty()) {
|
||||
setErrorMessage(N_("Missing argument"));
|
||||
break;
|
||||
}
|
||||
ProhibitInput(owner->view());
|
||||
string fname = i18nLibFileSearch("doc", arg, "lyx");
|
||||
string const fname = i18nLibFileSearch("doc", arg, "lyx");
|
||||
if (fname.empty()) {
|
||||
lyxerr << "LyX: unable to find documentation file `"
|
||||
<< arg << "'. Bad installation?" << endl;
|
||||
AllowInput(owner->view());
|
||||
break;
|
||||
}
|
||||
owner->getMiniBuffer()->Set(_("Opening help file"),
|
||||
MakeDisplayPath(fname),"...");
|
||||
string const str = _("Opening help file") + ' '
|
||||
+ MakeDisplayPath(fname) + "...";
|
||||
|
||||
owner->message(str);
|
||||
owner->view()->buffer(bufferlist.loadLyXFile(fname,false));
|
||||
AllowInput(owner->view());
|
||||
break;
|
||||
@ -1466,6 +1533,18 @@ string const LyXFunc::Dispatch(int ac,
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MESSAGE:
|
||||
owner->message(argument);
|
||||
break;
|
||||
|
||||
case LFUN_MESSAGE_PUSH:
|
||||
owner->messagePush(argument);
|
||||
break;
|
||||
|
||||
case LFUN_MESSAGE_POP:
|
||||
owner->messagePop();
|
||||
break;
|
||||
|
||||
default:
|
||||
// Then if it was none of the above
|
||||
if (!owner->view()->Dispatch(action, argument))
|
||||
@ -1479,19 +1558,11 @@ exit_with_message:
|
||||
|
||||
if (res.empty()) {
|
||||
if (!commandshortcut.empty()) {
|
||||
string const newbuf =
|
||||
owner->getMiniBuffer()->GetText();
|
||||
if (newbuf != commandshortcut) {
|
||||
owner->getMiniBuffer()->Set(newbuf
|
||||
+ " " +
|
||||
commandshortcut);
|
||||
}
|
||||
owner->getMiniBuffer()->addSet(commandshortcut);
|
||||
}
|
||||
} else {
|
||||
string msg(_(res));
|
||||
msg += " ";
|
||||
msg += commandshortcut;
|
||||
owner->getMiniBuffer()->Set(msg);
|
||||
string const msg(_(res) + ' ' + commandshortcut);
|
||||
owner->message(msg);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -1521,14 +1592,19 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
||||
|
||||
if (lyxrc.new_ask_filename) {
|
||||
FileDialog fileDlg(owner, _("Enter filename for new document"),
|
||||
LFUN_SELECT_FILE_SYNC,
|
||||
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||
make_pair(string(_("Templates")), string(lyxrc.template_path)));
|
||||
LFUN_SELECT_FILE_SYNC,
|
||||
make_pair(string(_("Documents")),
|
||||
string(lyxrc.document_path)),
|
||||
make_pair(string(_("Templates")),
|
||||
string(lyxrc.template_path)));
|
||||
|
||||
FileDialog::Result result = fileDlg.Select(initpath, _("*.lyx|LyX Documents (*.lyx)"), _("newfile"));
|
||||
FileDialog::Result result =
|
||||
fileDlg.Select(initpath,
|
||||
_("*.lyx|LyX Documents (*.lyx)"),
|
||||
_("newfile"));
|
||||
|
||||
if (result.second.empty()) {
|
||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||
Dispatch(LFUN_MESSAGE, _("Canceled."));
|
||||
lyxerr.debug() << "New Document Cancelled." << endl;
|
||||
return;
|
||||
}
|
||||
@ -1541,10 +1617,10 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
||||
|
||||
// Check if the document already is open
|
||||
if (bufferlist.exists(s)) {
|
||||
switch (AskConfirmation(_("Document is already open:"),
|
||||
MakeDisplayPath(s, 50),
|
||||
_("Do you want to close that document now?\n"
|
||||
"('No' will just switch to the open version)")))
|
||||
switch (AskConfirmation(_("Document is already open:"),
|
||||
MakeDisplayPath(s, 50),
|
||||
_("Do you want to close that document now?\n"
|
||||
"('No' will just switch to the open version)")))
|
||||
{
|
||||
case 1: // Yes: close the document
|
||||
if (!bufferlist.close(bufferlist.getBuffer(s)))
|
||||
@ -1555,7 +1631,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
||||
owner->view()->buffer(bufferlist.getBuffer(s));
|
||||
return;
|
||||
case 3: // Cancel: Do nothing
|
||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||
Dispatch(LFUN_MESSAGE, _("Canceled."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1567,14 +1643,14 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
||||
MakeDisplayPath(s, 50),
|
||||
_("Do you want to open the document?"))) {
|
||||
// loads document
|
||||
owner->getMiniBuffer()->Set(_("Opening document"),
|
||||
MakeDisplayPath(s), "...");
|
||||
Dispatch(LFUN_MESSAGE, _("Opening document")
|
||||
+ ' ' + MakeDisplayPath(s) + "...");
|
||||
XFlush(fl_get_display());
|
||||
owner->view()->buffer(
|
||||
bufferlist.loadLyXFile(s));
|
||||
owner->getMiniBuffer()->Set(_("Document"),
|
||||
MakeDisplayPath(s),
|
||||
_("opened."));
|
||||
Dispatch(LFUN_MESSAGE, _("Document")
|
||||
+ ' ' + MakeDisplayPath(s) + ' '
|
||||
+ _("opened."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1596,10 +1672,14 @@ void LyXFunc::MenuNew(bool fromTemplate)
|
||||
if (fromTemplate) {
|
||||
FileDialog fileDlg(owner, _("Select template file"),
|
||||
LFUN_SELECT_FILE_SYNC,
|
||||
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||
make_pair(string(_("Templates")), string(lyxrc.template_path)));
|
||||
make_pair(string(_("Documents")),
|
||||
string(lyxrc.document_path)),
|
||||
make_pair(string(_("Templates")),
|
||||
string(lyxrc.template_path)));
|
||||
|
||||
FileDialog::Result result = fileDlg.Select(initpath, _("*.lyx|LyX Documents (*.lyx)"));
|
||||
FileDialog::Result result =
|
||||
fileDlg.Select(initpath,
|
||||
_("*.lyx|LyX Documents (*.lyx)"));
|
||||
|
||||
if (result.first == FileDialog::Later)
|
||||
return;
|
||||
@ -1633,10 +1713,14 @@ void LyXFunc::Open(string const & fname)
|
||||
if (fname.empty()) {
|
||||
FileDialog fileDlg(owner, _("Select document to open"),
|
||||
LFUN_FILE_OPEN,
|
||||
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||
make_pair(string(_("Examples")), string(AddPath(system_lyxdir, "examples"))));
|
||||
make_pair(string(_("Documents")),
|
||||
string(lyxrc.document_path)),
|
||||
make_pair(string(_("Examples")),
|
||||
string(AddPath(system_lyxdir, "examples"))));
|
||||
|
||||
FileDialog::Result result = fileDlg.Select(initpath, "*.lyx|LyX Documents (*.lyx)");
|
||||
FileDialog::Result result =
|
||||
fileDlg.Select(initpath,
|
||||
"*.lyx|LyX Documents (*.lyx)");
|
||||
|
||||
if (result.first == FileDialog::Later)
|
||||
return;
|
||||
@ -1645,7 +1729,7 @@ void LyXFunc::Open(string const & fname)
|
||||
|
||||
// check selected filename
|
||||
if (filename.empty()) {
|
||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||
Dispatch(LFUN_MESSAGE, _("Canceled."));
|
||||
return;
|
||||
}
|
||||
} else
|
||||
@ -1658,17 +1742,19 @@ void LyXFunc::Open(string const & fname)
|
||||
filename += ".lyx";
|
||||
|
||||
// loads document
|
||||
owner->getMiniBuffer()->Set(_("Opening document"),
|
||||
MakeDisplayPath(filename), "...");
|
||||
Dispatch(LFUN_MESSAGE,
|
||||
_("Opening document") + ' '
|
||||
+ MakeDisplayPath(filename) + "...");
|
||||
Buffer * openbuf = bufferlist.loadLyXFile(filename);
|
||||
if (openbuf) {
|
||||
owner->view()->buffer(openbuf);
|
||||
owner->getMiniBuffer()->Set(_("Document"),
|
||||
MakeDisplayPath(filename),
|
||||
_("opened."));
|
||||
Dispatch(LFUN_MESSAGE,
|
||||
_("Document") + ' '
|
||||
+ MakeDisplayPath(filename) + ' ' + _("opened."));
|
||||
} else {
|
||||
owner->getMiniBuffer()->Set(_("Could not open document"),
|
||||
MakeDisplayPath(filename));
|
||||
Dispatch(LFUN_MESSAGE,
|
||||
_("Could not open document") + ' '
|
||||
+ MakeDisplayPath(filename));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1696,13 +1782,17 @@ void LyXFunc::doImport(string const & argument)
|
||||
|
||||
FileDialog fileDlg(owner, text,
|
||||
LFUN_IMPORT,
|
||||
make_pair(string(_("Documents")), string(lyxrc.document_path)),
|
||||
make_pair(string(_("Examples")), string(AddPath(system_lyxdir, "examples"))));
|
||||
make_pair(string(_("Documents")),
|
||||
string(lyxrc.document_path)),
|
||||
make_pair(string(_("Examples")),
|
||||
string(AddPath(system_lyxdir, "examples"))));
|
||||
|
||||
string const extension = "*." + formats.Extension(format) + "| " +
|
||||
formats.PrettyName(format) + " (*." + formats.Extension(format) + ")";
|
||||
string const extension = "*." + formats.Extension(format)
|
||||
+ "| " + formats.PrettyName(format)
|
||||
+ " (*." + formats.Extension(format) + ")";
|
||||
|
||||
FileDialog::Result result = fileDlg.Select(initpath, extension);
|
||||
FileDialog::Result result = fileDlg.Select(initpath,
|
||||
extension);
|
||||
|
||||
if (result.first == FileDialog::Later)
|
||||
return;
|
||||
@ -1710,8 +1800,8 @@ void LyXFunc::doImport(string const & argument)
|
||||
filename = result.second;
|
||||
|
||||
// check selected filename
|
||||
if (filename.empty())
|
||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||
if (filename.empty())
|
||||
Dispatch(LFUN_MESSAGE, _("Canceled."));
|
||||
}
|
||||
|
||||
// still no filename? abort
|
||||
@ -1726,9 +1816,9 @@ void LyXFunc::doImport(string const & argument)
|
||||
// Check if the document already is open
|
||||
if (bufferlist.exists(lyxfile)) {
|
||||
switch (AskConfirmation(_("Document is already open:"),
|
||||
MakeDisplayPath(lyxfile, 50),
|
||||
_("Do you want to close that document now?\n"
|
||||
"('No' will just switch to the open version)")))
|
||||
MakeDisplayPath(lyxfile, 50),
|
||||
_("Do you want to close that document now?\n"
|
||||
"('No' will just switch to the open version)")))
|
||||
{
|
||||
case 1: // Yes: close the document
|
||||
if (!bufferlist.close(bufferlist.getBuffer(lyxfile)))
|
||||
@ -1739,7 +1829,7 @@ void LyXFunc::doImport(string const & argument)
|
||||
owner->view()->buffer(bufferlist.getBuffer(lyxfile));
|
||||
return;
|
||||
case 3: // Cancel: Do nothing
|
||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||
Dispatch(LFUN_MESSAGE, _("Canceled."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1749,11 +1839,11 @@ void LyXFunc::doImport(string const & argument)
|
||||
if (f.exist() && !AskQuestion(_("A document by the name"),
|
||||
MakeDisplayPath(lyxfile),
|
||||
_("already exists. Overwrite?"))) {
|
||||
owner->getMiniBuffer()->Set(_("Canceled."));
|
||||
Dispatch(LFUN_MESSAGE, _("Canceled"));
|
||||
return;
|
||||
}
|
||||
// filename should be valid now
|
||||
|
||||
|
||||
Importer::Import(owner, filename, format);
|
||||
}
|
||||
|
||||
@ -1798,3 +1888,50 @@ void LyXFunc::setMessage(string const & m)
|
||||
{
|
||||
dispatch_buffer = m;
|
||||
}
|
||||
|
||||
|
||||
void LyXFunc::initMiniBuffer()
|
||||
{
|
||||
string text = _("Welcome to LyX!");
|
||||
|
||||
// When meta-fake key is pressed, show the key sequence so far + "M-".
|
||||
if (wasMetaKey()) {
|
||||
keyseqStr();
|
||||
text += "M-";
|
||||
}
|
||||
|
||||
// Else, when a non-complete key sequence is pressed,
|
||||
// show the available options.
|
||||
else if (keyseqUncomplete())
|
||||
text = keyseqOptions();
|
||||
|
||||
// Else, show the buffer state.
|
||||
else if (owner->view()->available()) {
|
||||
Buffer * tmpbuf = owner->buffer();
|
||||
|
||||
string const nicename =
|
||||
MakeDisplayPath(tmpbuf->fileName());
|
||||
// Should we do this instead? (kindo like emacs)
|
||||
// leaves more room for other information
|
||||
text = "LyX: ";
|
||||
text += nicename;
|
||||
if (tmpbuf->lyxvc.inUse()) {
|
||||
text += " [";
|
||||
text += tmpbuf->lyxvc.version();
|
||||
text += ' ';
|
||||
text += tmpbuf->lyxvc.locker();
|
||||
if (tmpbuf->isReadonly())
|
||||
text += " (RO)";
|
||||
text += ']';
|
||||
} else if (tmpbuf->isReadonly())
|
||||
text += " [RO]";
|
||||
if (!tmpbuf->isLyxClean())
|
||||
text += _(" (Changed)");
|
||||
} else {
|
||||
if (text != _("Welcome to LyX!")) // this is a hack
|
||||
text = _("* No document open *");
|
||||
}
|
||||
|
||||
owner->message(text);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
#ifndef LYXFUNC_H
|
||||
#define LYXFUNC_H
|
||||
|
||||
#include <sigc++/signal_system.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
@ -13,7 +15,7 @@
|
||||
#include "LString.h"
|
||||
|
||||
class LyXView;
|
||||
class auto_mem_buffer;
|
||||
|
||||
|
||||
/** This class encapsulates all the LyX command operations.
|
||||
This is the class of the LyX's "high level event handler".
|
||||
@ -21,7 +23,7 @@ class auto_mem_buffer;
|
||||
keyboard or from the GUI. All GUI objects, including buttons and
|
||||
menus should use this class and never call kernel functions directly.
|
||||
*/
|
||||
class LyXFunc {
|
||||
class LyXFunc : public SigC::Object {
|
||||
public:
|
||||
/// The status of a function.
|
||||
enum func_status {
|
||||
@ -46,9 +48,12 @@ public:
|
||||
/// The same but uses the name of a lyx command.
|
||||
string const Dispatch(string const & cmd);
|
||||
|
||||
/// Same again but for xtl buffers. Still looking for better idea.
|
||||
bool Dispatch(int action, auto_mem_buffer &);
|
||||
///
|
||||
void miniDispatch(string const & cmd);
|
||||
|
||||
///
|
||||
void initMiniBuffer();
|
||||
|
||||
///
|
||||
int processKeySym(KeySym k, unsigned int state);
|
||||
|
||||
|
@ -68,7 +68,7 @@ void LyXLex::Pimpl::verifyTable()
|
||||
{
|
||||
// Check if the table is sorted and if not, sort it.
|
||||
if (table
|
||||
&& !sorted(table, table + no_items, compare_tags())) {
|
||||
&& !lyx::sorted(table, table + no_items, compare_tags())) {
|
||||
lyxerr << "The table passed to LyXLex is not sorted!\n"
|
||||
<< "Tell the developers to fix it!" << endl;
|
||||
// We sort it anyway to avoid problems.
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "insets/lyxinset.h"
|
||||
#include "ParagraphParameters.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
class BufferParams;
|
||||
class LyXBuffer;
|
||||
@ -250,7 +251,7 @@ public:
|
||||
|
||||
private:
|
||||
///
|
||||
array<int, 10> counter_;
|
||||
boost::array<int, 10> counter_;
|
||||
public:
|
||||
///
|
||||
void setCounter(int i, int v);
|
||||
@ -641,6 +642,23 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#ifdef NEW_INSETS
|
||||
inline
|
||||
LyXParagraph::value_type
|
||||
LyXParagraph::GetChar(LyXParagraph::size_type pos) const
|
||||
{
|
||||
Assert(pos <= size());
|
||||
// This is stronger, and I belive that this is the assertion
|
||||
// that we should really use. (Lgb)
|
||||
//Assert(pos < size());
|
||||
|
||||
// Then this has no meaning. (Lgb)
|
||||
if (!size() || pos == size()) return '\0';
|
||||
|
||||
return text[pos];
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
int LyXParagraph::id() const
|
||||
{
|
||||
@ -714,6 +732,17 @@ void LyXParagraph::SetChar(size_type pos, value_type c)
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXTextClass::size_type LyXParagraph::GetLayout() const
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
return FirstPhysicalPar()->layout;
|
||||
#else
|
||||
return layout;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXParagraph::inset_iterator LyXParagraph::inset_iterator_begin()
|
||||
{
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include "lyxcursor.h"
|
||||
#include "lyxparagraph.h"
|
||||
#include "layout.h"
|
||||
#include "lyxrow.h"
|
||||
|
||||
class Buffer;
|
||||
class BufferParams;
|
||||
class Row;
|
||||
class BufferView;
|
||||
class InsetText;
|
||||
|
||||
@ -666,4 +666,23 @@ private:
|
||||
LyXParagraph * OwnerParagraph(LyXParagraph *) const;
|
||||
};
|
||||
|
||||
|
||||
/* returns a pointer to the row near the specified y-coordinate
|
||||
* (relative to the whole text). y is set to the real beginning
|
||||
* of this row */
|
||||
inline
|
||||
Row * LyXText::GetRowNearY(int & y) const
|
||||
{
|
||||
// If possible we should optimize this method. (Lgb)
|
||||
Row * tmprow = firstrow;
|
||||
int tmpy = 0;
|
||||
|
||||
while (tmprow->next() && tmpy + tmprow->height() <= y) {
|
||||
tmpy += tmprow->height();
|
||||
tmprow = tmprow->next();
|
||||
}
|
||||
|
||||
y = tmpy; // return the real y
|
||||
return tmprow;
|
||||
}
|
||||
#endif
|
||||
|
348
src/minibuffer.C
348
src/minibuffer.C
@ -13,129 +13,211 @@
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "minibuffer.h"
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "minibuffer.h"
|
||||
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyxfunc.h"
|
||||
#include FORMS_H_LOCATION
|
||||
#include "minibuffer.h"
|
||||
#include "LyXView.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "LyXAction.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
|
||||
|
||||
using std::endl;
|
||||
using SigC::slot;
|
||||
|
||||
extern bool keyseqUncomplete();
|
||||
extern string keyseqOptions(int l = 190);
|
||||
extern string keyseqStr(int l = 190);
|
||||
extern LyXAction lyxaction;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct prefix {
|
||||
string p;
|
||||
prefix(string const & s)
|
||||
: p(s) {}
|
||||
bool operator()(string const & s) const {
|
||||
return prefixIs(s, p);
|
||||
}
|
||||
};
|
||||
|
||||
} // end of anon namespace
|
||||
|
||||
|
||||
MiniBuffer::MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y,
|
||||
FL_Coord h, FL_Coord w)
|
||||
: owner(o)
|
||||
: stored_(false), owner_(o), state_(spaces)
|
||||
{
|
||||
text = _("Welcome to LyX!");
|
||||
shows_no_match = true;
|
||||
history_idx = history_cnt = 0;
|
||||
add(FL_NORMAL_INPUT, x, y, h, w);
|
||||
timer.timeout.connect(slot(this, &MiniBuffer::Init));
|
||||
timer.setTimeout(6000);
|
||||
timer.timeout.connect(slot(this, &MiniBuffer::init));
|
||||
stored_timer.setTimeout(1500);
|
||||
stored_timer.timeout.connect(slot(this, &MiniBuffer::stored_slot));
|
||||
deactivate();
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
|
||||
void MiniBuffer::stored_slot()
|
||||
{
|
||||
MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||
lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
|
||||
obj->owner->view()->focus(true);
|
||||
|
||||
if (obj->cur_cmd.empty()) {
|
||||
obj->Init();
|
||||
return ;
|
||||
if (stored_) {
|
||||
stored_ = false;
|
||||
fl_set_input(the_buffer, stored_input.c_str());
|
||||
}
|
||||
obj->Set(_("Executing:"), obj->cur_cmd);
|
||||
obj->addHistory(obj->cur_cmd);
|
||||
|
||||
// Dispatch only returns requested data for a few commands (ale)
|
||||
string const res = obj->owner->getLyXFunc()->Dispatch(obj->cur_cmd);
|
||||
lyxerr.debug() << "Minibuffer Res: " << res << endl;
|
||||
obj->shows_no_match = false;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
void C_MiniBuffer_ExecutingCB(FL_OBJECT * ob, long)
|
||||
void MiniBuffer::stored_set(string const & str)
|
||||
{
|
||||
MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||
obj->Init();
|
||||
stored_input = str;
|
||||
stored_ = true;
|
||||
stored_timer.start();
|
||||
}
|
||||
|
||||
|
||||
// This is not as dirty as it seems, the hidden buttons removed by this
|
||||
// function were just kludges for an uncomplete keyboard callback (ale)
|
||||
int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
|
||||
int key, void */*xev*/)
|
||||
int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
|
||||
{
|
||||
MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||
|
||||
switch (event) {
|
||||
case FL_KEYBOARD:
|
||||
{
|
||||
char const * tmp = fl_get_input(ob);
|
||||
string input = tmp ? tmp : "";
|
||||
if (stored_) {
|
||||
stored_timer.stop();
|
||||
input = stored_input;
|
||||
fl_set_input(ob, input.c_str());
|
||||
stored_ = false;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case XK_Down:
|
||||
mini->history_idx++;
|
||||
if (!mini->getHistory().empty()) {
|
||||
fl_set_input(ob, mini->getHistory().c_str());
|
||||
} else
|
||||
mini->history_idx--;
|
||||
if (hist_iter != history_->end()) {
|
||||
++hist_iter;
|
||||
}
|
||||
if (hist_iter == history_->end()) {
|
||||
// no further history
|
||||
stored_set(input);
|
||||
fl_set_input(ob, _("[End of history]"));
|
||||
} else {
|
||||
fl_set_input(ob, (*hist_iter).c_str());
|
||||
}
|
||||
return 1;
|
||||
case XK_Up:
|
||||
if (mini->history_idx > 0) mini->history_idx--;
|
||||
fl_set_input(ob, mini->getHistory().c_str());
|
||||
if (hist_iter == history_->begin()) {
|
||||
// no further history
|
||||
stored_set(input);
|
||||
fl_set_input(ob, _("[Beginning of history]"));
|
||||
} else {
|
||||
--hist_iter;
|
||||
fl_set_input(ob, (*hist_iter).c_str());
|
||||
}
|
||||
return 1;
|
||||
case 9:
|
||||
case XK_Tab:
|
||||
{
|
||||
// complete or increment the command
|
||||
string const s(lyxaction.getApproxFuncName(fl_get_input(ob)));
|
||||
if (!s.empty())
|
||||
fl_set_input(ob, s.c_str());
|
||||
// Completion handling.
|
||||
|
||||
vector<string> comp;
|
||||
lyx::copy_if(completion_.begin(),
|
||||
completion_.end(),
|
||||
back_inserter(comp), prefix(input));
|
||||
|
||||
if (comp.empty()) {
|
||||
// No matches
|
||||
string const tmp = input + _(" [no match]");
|
||||
stored_set(input);
|
||||
fl_set_input(ob, tmp.c_str());
|
||||
} else if (comp.size() == 1) {
|
||||
// Perfect match
|
||||
string const tmp =
|
||||
comp[0] + _(" [sole completion]");
|
||||
stored_set(comp[0]);
|
||||
fl_set_input(ob, tmp.c_str());
|
||||
} else {
|
||||
// More that one match
|
||||
// Find maximal avaliable prefix
|
||||
string const tmp = comp[0];
|
||||
string test(input);
|
||||
test += tmp[test.length()];
|
||||
while (test.length() < tmp.length()) {
|
||||
vector<string> vtmp;
|
||||
lyx::copy_if(comp.begin(),
|
||||
comp.end(),
|
||||
back_inserter(vtmp),
|
||||
prefix(test));
|
||||
if (vtmp.size() != comp.size()) {
|
||||
test.erase(test.length() - 1);
|
||||
break;
|
||||
}
|
||||
test += tmp[test.length()];
|
||||
}
|
||||
fl_set_input(ob, test.c_str());
|
||||
|
||||
// How should the possible matches
|
||||
// be visualized?
|
||||
std::copy(comp.begin(), comp.end(),
|
||||
ostream_iterator<string>(cerr, "\n"));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case 27:
|
||||
case XK_Escape:
|
||||
// Abort
|
||||
mini->owner->view()->focus(true);
|
||||
mini->Init();
|
||||
owner_->view()->focus(true);
|
||||
init();
|
||||
deactivate();
|
||||
//escape.emit();
|
||||
return 1;
|
||||
case 13:
|
||||
case XK_Return:
|
||||
// Execute a command.
|
||||
mini->cur_cmd = string(fl_get_input(ob));
|
||||
ExecutingCB(ob, 0);
|
||||
{
|
||||
// First check for match
|
||||
vector<string>::const_iterator cit =
|
||||
std::find(completion_.begin(),
|
||||
completion_.end(),
|
||||
input);
|
||||
if (cit == completion_.end()) {
|
||||
// no such func/item
|
||||
stored_set(input);
|
||||
string const tmp = input + _(" [no match]");
|
||||
fl_set_input(ob, tmp.c_str());
|
||||
} else {
|
||||
// Return the inputted string
|
||||
deactivate();
|
||||
owner_->view()->focus(true);
|
||||
history_->push_back(input);
|
||||
stringReady.emit(input);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case XK_space:
|
||||
{
|
||||
// Depending on the input state spaces might not
|
||||
// be allowed.
|
||||
switch (state_) {
|
||||
case spaces:
|
||||
return 0;
|
||||
case nospaces:
|
||||
{
|
||||
stored_set(input);
|
||||
string const tmp = input + _(" [no match]");
|
||||
fl_set_input(ob, tmp.c_str());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
case FL_PUSH:
|
||||
// This actually clears the buffer.
|
||||
mini->PrepareForCommand();
|
||||
return 1;
|
||||
case FL_DRAW:
|
||||
//lyxerr << "Minibuffer event: DRAW" << endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
//lyxerr << "Unhandled minibuffer event!" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -143,17 +225,19 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
|
||||
extern "C"
|
||||
int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
|
||||
FL_Coord, FL_Coord,
|
||||
int key, void * xev)
|
||||
int key, void * /*xev*/)
|
||||
{
|
||||
return MiniBuffer::peek_event(ob, event, 0, 0, key, xev);
|
||||
MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||
return mini->peek_event(ob, event, key);
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::PrepareForCommand()
|
||||
void MiniBuffer::prepare()
|
||||
{
|
||||
text.erase();
|
||||
fl_set_input(the_buffer, "");
|
||||
fl_set_focus_object(owner->getForm(), the_buffer);
|
||||
activate();
|
||||
fl_set_focus_object(owner_->getForm(), the_buffer);
|
||||
}
|
||||
|
||||
|
||||
@ -168,8 +252,7 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
|
||||
fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity);
|
||||
fl_set_object_color(obj, FL_MCOL, FL_MCOL);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_MiniBuffer_ExecutingCB, 0);
|
||||
|
||||
|
||||
// To intercept Up, Down, Table for history
|
||||
fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
|
||||
obj->u_vdata = this;
|
||||
@ -181,103 +264,78 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
|
||||
}
|
||||
|
||||
|
||||
// Added optional arg `delay_secs', defaults to 4.
|
||||
//When 0, no timeout is done. RVDK_PATCH_5
|
||||
void MiniBuffer::Set(string const& s1, string const& s2,
|
||||
string const& s3, unsigned int delay_secs)
|
||||
void MiniBuffer::message(string const & str)
|
||||
{
|
||||
if (delay_secs)
|
||||
timer.setTimeout(delay_secs * 1000).restart();
|
||||
else
|
||||
timer.stop();
|
||||
|
||||
string const ntext = strip(s1 + ' ' + s2 + ' ' + s3);
|
||||
|
||||
timer.restart();
|
||||
string const ntext = strip(str);
|
||||
if (!the_buffer->focus) {
|
||||
fl_set_input(the_buffer, ntext.c_str());
|
||||
XFlush(fl_get_display());
|
||||
text = ntext;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::Init()
|
||||
void MiniBuffer::messagePush(string const & str)
|
||||
{
|
||||
// If we have focus, we don't want to change anything.
|
||||
if (the_buffer->focus)
|
||||
return;
|
||||
|
||||
// When meta-fake key is pressed, show the key sequence so far + "M-".
|
||||
if (owner->getLyXFunc()->wasMetaKey()) {
|
||||
text = owner->getLyXFunc()->keyseqStr();
|
||||
text += " M-";
|
||||
}
|
||||
|
||||
// Else, when a non-complete key sequence is pressed,
|
||||
// show the available options.
|
||||
else if (owner->getLyXFunc()->keyseqUncomplete())
|
||||
text = owner->getLyXFunc()->keyseqOptions();
|
||||
|
||||
// Else, show the buffer state.
|
||||
else if (owner->view()->available()) {
|
||||
string const nicename =
|
||||
MakeDisplayPath(owner->buffer()->
|
||||
fileName());
|
||||
// Should we do this instead? (kindo like emacs)
|
||||
// leaves more room for other information
|
||||
text = "LyX: ";
|
||||
text += nicename;
|
||||
if (owner->buffer()->lyxvc.inUse()) {
|
||||
text += " [";
|
||||
text += owner->buffer()->lyxvc.version();
|
||||
text += ' ';
|
||||
text += owner->buffer()->lyxvc.locker();
|
||||
if (owner->buffer()->isReadonly())
|
||||
text += " (RO)";
|
||||
text += ']';
|
||||
} else if (owner->buffer()->isReadonly())
|
||||
text += " [RO]";
|
||||
if (!owner->buffer()->isLyxClean())
|
||||
text += _(" (Changed)");
|
||||
} else {
|
||||
if (text != _("Welcome to LyX!")) // this is a hack
|
||||
text = _("* No document open *");
|
||||
}
|
||||
|
||||
|
||||
fl_set_input(the_buffer, text.c_str());
|
||||
|
||||
timer.stop();
|
||||
|
||||
XFlush(fl_get_display());
|
||||
text_stored = text;
|
||||
message(str);
|
||||
}
|
||||
|
||||
|
||||
// allows to store and reset the contents one time. Usefull for
|
||||
// status messages like "load font" (Matthias)
|
||||
void MiniBuffer::Store()
|
||||
void MiniBuffer::messagePop()
|
||||
{
|
||||
text_stored = fl_get_input(the_buffer);
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::Reset()
|
||||
{
|
||||
if (!text_stored.empty()){
|
||||
Set(text_stored);
|
||||
if (!text_stored.empty()) {
|
||||
message(text_stored);
|
||||
text_stored.erase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::Activate()
|
||||
void MiniBuffer::addSet(string const & s1, string const & s2)
|
||||
{
|
||||
string const str = text + ' ' + s1 + ' ' + s2;
|
||||
message(str);
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::getString(State spaces,
|
||||
vector<string> const & completion,
|
||||
vector<string> & history)
|
||||
{
|
||||
state_ = spaces;
|
||||
completion_ = completion;
|
||||
history_ = &history;
|
||||
hist_iter = history_->end();
|
||||
prepare();
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::init()
|
||||
{
|
||||
// If we have focus, we don't want to change anything.
|
||||
if (the_buffer->focus)
|
||||
return;
|
||||
|
||||
timeout.emit();
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::activate()
|
||||
{
|
||||
fl_activate_object(the_buffer);
|
||||
fl_redraw_object(the_buffer);
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::Deactivate()
|
||||
void MiniBuffer::deactivate()
|
||||
{
|
||||
fl_redraw_object(the_buffer);
|
||||
fl_deactivate_object(the_buffer);
|
||||
}
|
||||
|
||||
|
||||
void MiniBuffer::redraw()
|
||||
{
|
||||
fl_redraw_object(the_buffer);
|
||||
}
|
||||
|
104
src/minibuffer.h
104
src/minibuffer.h
@ -2,9 +2,11 @@
|
||||
#ifndef MINIBUFFER_H
|
||||
#define MINIBUFFER_H
|
||||
|
||||
#include <sigc++/signal_system.h>
|
||||
#include <vector>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "LString.h"
|
||||
#include "gettext.h"
|
||||
#include "frontends/Timeout.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
@ -16,49 +18,63 @@ class LyXView;
|
||||
///
|
||||
class MiniBuffer : public SigC::Object {
|
||||
public:
|
||||
enum State {
|
||||
spaces,
|
||||
nospaces
|
||||
};
|
||||
|
||||
///
|
||||
MiniBuffer(LyXView * o,
|
||||
FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
|
||||
|
||||
///
|
||||
bool shows_no_match;
|
||||
void addSet(string const &,
|
||||
string const & = string());
|
||||
|
||||
#if 0
|
||||
///
|
||||
void setTimer(unsigned int a) {
|
||||
timer.setTimeout(a * 1000);
|
||||
}
|
||||
#endif
|
||||
void message(string const & str);
|
||||
///
|
||||
void messagePush(string const & str);
|
||||
///
|
||||
void messagePop();
|
||||
|
||||
/** Makes the minibuffer wait for a string to be inserted.
|
||||
Waits for a string to be inserted into the minibuffer, when
|
||||
the string has been insterted the signal stringReady is
|
||||
emitted.
|
||||
*/
|
||||
void getString(State space,
|
||||
vector<string> const & completion,
|
||||
vector<string> & history);
|
||||
///
|
||||
void Set(string const & = string(),
|
||||
string const & = string(),
|
||||
string const & = string(),
|
||||
unsigned int delay_secs = 6);
|
||||
///
|
||||
string const GetText() const { return text; }
|
||||
void redraw();
|
||||
///
|
||||
void Init();
|
||||
int peek_event(FL_OBJECT *, int, int);
|
||||
///
|
||||
void PrepareForCommand();
|
||||
/** allows to store and reset the contents one time. Usefull
|
||||
for status messages like "load font" (Matthias)
|
||||
*/
|
||||
void Store();
|
||||
SigC::Signal1<void, string const &> stringReady;
|
||||
///
|
||||
void Reset();
|
||||
//SigC::Signal0<void> escape;
|
||||
///
|
||||
void Activate();
|
||||
///
|
||||
void Deactivate();
|
||||
///
|
||||
static void ExecutingCB(FL_OBJECT * ob, long);
|
||||
///
|
||||
static int peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord,
|
||||
int, void *);
|
||||
SigC::Signal0<void> timeout;
|
||||
private:
|
||||
///
|
||||
LyXView * owner;
|
||||
void activate();
|
||||
///
|
||||
void deactivate();
|
||||
///
|
||||
void prepare();
|
||||
///
|
||||
void stored_slot();
|
||||
///
|
||||
void stored_set(string const &);
|
||||
///
|
||||
void init();
|
||||
///
|
||||
string stored_input;
|
||||
///
|
||||
bool stored_;
|
||||
///
|
||||
LyXView * owner_;
|
||||
///
|
||||
string text;
|
||||
///
|
||||
@ -68,30 +84,16 @@ private:
|
||||
///
|
||||
Timeout timer;
|
||||
///
|
||||
Timeout stored_timer;
|
||||
///
|
||||
FL_OBJECT * the_buffer;
|
||||
///
|
||||
string cur_cmd;
|
||||
///
|
||||
enum{ MAX_HISTORY = 10 };
|
||||
///
|
||||
mutable string history[MAX_HISTORY];
|
||||
///
|
||||
mutable int history_idx;
|
||||
vector<string> completion_;
|
||||
///
|
||||
mutable int history_cnt;
|
||||
///
|
||||
void addHistory(string const & cmd) const {
|
||||
if (history_cnt == 0
|
||||
|| (history_cnt > 0
|
||||
&& cmd != history[(history_cnt - 1) % MAX_HISTORY])) {
|
||||
history[history_cnt % MAX_HISTORY] = cmd;
|
||||
++history_cnt;
|
||||
}
|
||||
history_idx = history_cnt;
|
||||
}
|
||||
///
|
||||
string const getHistory() const {
|
||||
return history[history_idx % MAX_HISTORY];
|
||||
}
|
||||
vector<string> * history_;
|
||||
///
|
||||
vector<string>::iterator hist_iter;
|
||||
///
|
||||
State state_;
|
||||
};
|
||||
#endif
|
||||
|
@ -988,14 +988,14 @@ LyXParagraph::GetChar(LyXParagraph::size_type pos) const
|
||||
}
|
||||
}
|
||||
#else
|
||||
LyXParagraph::value_type
|
||||
LyXParagraph::GetChar(LyXParagraph::size_type pos) const
|
||||
{
|
||||
Assert(pos <= size());
|
||||
if (!size() || pos == size()) return '\0';
|
||||
|
||||
return text[pos];
|
||||
}
|
||||
//LyXParagraph::value_type
|
||||
//LyXParagraph::GetChar(LyXParagraph::size_type pos) const
|
||||
//{
|
||||
// Assert(pos <= size());
|
||||
// if (!size() || pos == size()) return '\0';
|
||||
//
|
||||
// return text[pos];
|
||||
//}
|
||||
#endif
|
||||
|
||||
|
||||
@ -1870,16 +1870,6 @@ int LyXParagraph::GetEndLabel(BufferParams const & bparams) const
|
||||
}
|
||||
|
||||
|
||||
LyXTextClass::size_type LyXParagraph::GetLayout() const
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
return FirstPhysicalPar()->layout;
|
||||
#else
|
||||
return layout;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
char LyXParagraph::GetDepth() const
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
@ -1991,30 +1981,7 @@ void LyXParagraph::SetOnlyLayout(BufferParams const & bparams,
|
||||
#else
|
||||
void LyXParagraph::SetOnlyLayout(LyXTextClass::size_type new_layout)
|
||||
{
|
||||
#if 0
|
||||
LyXParagraph * par = this;
|
||||
LyXParagraph * ppar = 0;
|
||||
LyXParagraph * npar = 0;
|
||||
|
||||
par->layout = new_layout;
|
||||
|
||||
if (par->previous()) {
|
||||
ppar = par->previous();
|
||||
while(ppar
|
||||
&& ppar->previous()
|
||||
&& (ppar->params.depth() > par->params.depth()))
|
||||
ppar = ppar->previous();
|
||||
}
|
||||
if (par->next()) {
|
||||
npar = par->next();
|
||||
while(npar
|
||||
&& npar->next()
|
||||
&& (npar->params.depth() > par->params.depth()))
|
||||
npar = npar->next();
|
||||
}
|
||||
#else
|
||||
layout = new_layout;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
13
src/text.C
13
src/text.C
@ -13,9 +13,9 @@
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
#include "lyxtext.h"
|
||||
#include "layout.h"
|
||||
#include "lyxparagraph.h"
|
||||
#include "lyxtext.h"
|
||||
#include "support/textutils.h"
|
||||
#include "insets/insetbib.h"
|
||||
#include "insets/insettext.h"
|
||||
@ -23,11 +23,9 @@
|
||||
#include "gettext.h"
|
||||
#include "bufferparams.h"
|
||||
#include "buffer.h"
|
||||
#include "minibuffer.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "LyXView.h"
|
||||
#include "lyxrow.h"
|
||||
#include "Painter.h"
|
||||
#include "tracer.h"
|
||||
#include "font.h"
|
||||
@ -35,6 +33,7 @@
|
||||
#include "lyxscreen.h"
|
||||
#include "bufferview_funcs.h"
|
||||
#include "language.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
@ -2110,9 +2109,13 @@ void LyXText::InsertChar(BufferView * bview, char c)
|
||||
#endif
|
||||
)) {
|
||||
if (cursor.pos() == 0 )
|
||||
bview->owner()->getMiniBuffer()->Set(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
|
||||
bview->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
|
||||
else
|
||||
bview->owner()->getMiniBuffer()->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
|
||||
bview->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("You cannot type two spaces this way. Please read the Tutorial."));
|
||||
charInserted();
|
||||
return;
|
||||
}
|
||||
|
29
src/text2.C
29
src/text2.C
@ -17,6 +17,7 @@
|
||||
#pragma implementation "lyxtext.h"
|
||||
#endif
|
||||
|
||||
#include "lyxtext.h"
|
||||
#include "LString.h"
|
||||
#include "lyxparagraph.h"
|
||||
#include "insets/inseterror.h"
|
||||
@ -28,15 +29,12 @@
|
||||
#include "LyXView.h"
|
||||
#include "support/textutils.h"
|
||||
#include "undo.h"
|
||||
#include "minibuffer.h"
|
||||
#include "buffer.h"
|
||||
#include "bufferparams.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "lyxtext.h"
|
||||
#include "gettext.h"
|
||||
#include "BufferView.h"
|
||||
#include "LyXView.h"
|
||||
#include "lyxrow.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "Painter.h"
|
||||
#include "font.h"
|
||||
@ -44,6 +42,7 @@
|
||||
#include "lyxrc.h"
|
||||
#include "FloatList.h"
|
||||
#include "language.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using std::copy;
|
||||
using std::find;
|
||||
@ -1317,33 +1316,15 @@ void LyXText::CursorBottom(BufferView * bview) const
|
||||
}
|
||||
|
||||
|
||||
/* returns a pointer to the row near the specified y-coordinate
|
||||
* (relative to the whole text). y is set to the real beginning
|
||||
* of this row */
|
||||
Row * LyXText::GetRowNearY(int & y) const
|
||||
{
|
||||
Row * tmprow = firstrow;
|
||||
int tmpy = 0;
|
||||
|
||||
while (tmprow->next() && tmpy + tmprow->height() <= y) {
|
||||
tmpy += tmprow->height();
|
||||
tmprow = tmprow->next();
|
||||
}
|
||||
|
||||
y = tmpy; // return the real y
|
||||
return tmprow;
|
||||
}
|
||||
|
||||
|
||||
void LyXText::ToggleFree(BufferView * bview,
|
||||
LyXFont const & font, bool toggleall)
|
||||
{
|
||||
// If the mask is completely neutral, tell user
|
||||
if (font == LyXFont(LyXFont::ALL_IGNORE)) {
|
||||
// Could only happen with user style
|
||||
bview->owner()->getMiniBuffer()
|
||||
->Set(_("No font change defined. Use Character under"
|
||||
" the Layout menu to define font change."));
|
||||
bview->owner()->getLyXFunc()
|
||||
->Dispatch(LFUN_MESSAGE,
|
||||
_("No font change defined. Use Character under the Layout menu to define font change."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user