- Got rid of two global variables:

minibuffer and FD_form_main


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@386 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Asger Ottar Alstrup 1999-12-19 22:35:36 +00:00
parent bc1d43e392
commit 4ed68c1bc2
19 changed files with 204 additions and 183 deletions

View File

@ -1,3 +1,9 @@
1999-12-19 Asger Alstrup Nielsen <alstrup@diku.dk>
* The global MiniBuffer * minibuffer variable is dead.
* The global FD_form_main * fd_form_main variable is dead.
1999-12-17 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/toolbar.C (set): condition #warning on WITH_WARNINGS

View File

@ -1300,14 +1300,14 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
{
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
/* quite a nice place for asyncron Inset updating, isn't it? */
// actually no! This is run even if no buffer exist... so (Lgb)
// Quite a nice place for asyncron Inset updating, isn't it?
// Actually no! This is run even if no buffer exist... so (Lgb)
if (view && !view->buffer_) {
goto set_timer_and_return;
}
// NOTE:
// On my quest to solve the gs rendre hangups I am now
// On my quest to solve the gs render hangups I am now
// disabling the SIGHUP completely, and will do a wait
// now and then instead. If the guess that xforms somehow
// destroys something is true, this is likely (hopefully)
@ -1480,7 +1480,7 @@ void BufferView::cursorPrevious()
Row * cursorrow = text->cursor.row;
text->SetCursorFromCoordinates(text->cursor.x_fix, y);
text->FinishUndo();
// this is to allow jumping over large insets
// This is to allow jumping over large insets
if ((cursorrow == text->cursor.row))
text->CursorUp();
@ -1501,7 +1501,7 @@ void BufferView::cursorNext()
Row * cursorrow = text->cursor.row;
text->SetCursorFromCoordinates(text->cursor.x_fix, y + work_area->h);
text->FinishUndo();
/* this is to allow jumping over large insets */
// This is to allow jumping over large insets
if ((cursorrow == text->cursor.row))
text->CursorDown();
@ -1543,7 +1543,6 @@ void BufferView::restorePosition()
}
// candidate for move to BufferView
void BufferView::update(signed char f)
{
owner()->updateLayoutChoice();

View File

@ -23,8 +23,10 @@
#include "debug.h"
#include "lyxrc.h" // lyxrc.font_*
extern LyXRC * lyxrc;
#include "BufferView.h"
#include "LyXView.h"
#include "minibuffer.h"
extern MiniBuffer *minibuffer;
extern BufferView * current_view;
// Initialize font loader
FontLoader::FontLoader()
@ -213,8 +215,8 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
font = "fixed";
}
minibuffer->Store();
minibuffer->Set(_("Loading font into X-Server..."));
current_view->owner()->getMiniBuffer()->Store();
current_view->owner()->getMiniBuffer()->Set(_("Loading font into X-Server..."));
XFontStruct * fs = XLoadQueryFont(fl_display, font.c_str());
@ -243,7 +245,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
<< "' matched by\n" << font << endl;
}
}
minibuffer->Reset();
current_view->owner()->getMiniBuffer()->Reset();
fontstruct[family][series][shape][size] = fs;
return fs;

View File

@ -32,11 +32,6 @@
#include "lyxtext.h"
extern FD_form_document * fd_form_document;
FD_form_main * fd_form_main; /* a pointer to the one in LyXView
should be removed as soon as possible */
MiniBuffer * minibuffer;/* a pointer to the one in LyXView
should be removed as soon as possible */
extern void AutoSave();
extern char updatetimer;
@ -50,7 +45,7 @@ extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
LyXView::LyXView(int width, int height)
{
fd_form_main = create_form_form_main(width, height);
create_form_form_main(width, height);
fl_set_form_atclose(_form, C_LyXView_atCloseMainFormCB, 0);
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
lyxfunc = new LyXFunc(this);
@ -154,7 +149,7 @@ void LyXView::show(int place, int border, char const * title)
}
FD_form_main * LyXView::create_form_form_main(int width, int height)
void LyXView::create_form_form_main(int width, int height)
/* to make this work as it should, .lyxrc should have been
* read first; OR maybe this one should be made dynamic.
* Hmmmm. Lgb.
@ -212,7 +207,6 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
minibuffer = new MiniBuffer(this, air, height-(25+air),
width-(2*air), 25);
::minibuffer = minibuffer; // to be removed later
//
// TIMERS
@ -250,8 +244,6 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
fl_set_form_minsize(fdui->form_main, 50, 50);
fl_end_form();
return fdui;
}
@ -285,10 +277,10 @@ void LyXView::invalidateLayoutChoice()
void LyXView::updateLayoutChoice()
{
/* update the layout display */
// Update the layout display
if (!toolbar->combox) return;
// this has a bi-effect that the layouts are not showed when no
// This has a side-effect that the layouts are not showed when no
// document is loaded.
if (bufferview == 0 || bufferview->buffer() == 0) {
toolbar->combox->clear();
@ -302,7 +294,7 @@ void LyXView::updateLayoutChoice()
toolbar->combox->clear();
for (int i = 0;
textclasslist.NameOfLayout(buffer()->
params.textclass, i) != "@@end@@";
params.textclass, i) != "@@end@@";
i++) {
LyXLayout const & layout = textclasslist.
Style(buffer()->params.textclass, i);
@ -328,7 +320,7 @@ void LyXView::updateLayoutChoice()
void LyXView::UpdateDocumentClassChoice()
{
// update the document class display in the document form
// Update the document class display in the document form
if (fd_form_document) {
fl_clear_choice(fd_form_document->choice_class);
for (int i = 0;
@ -349,7 +341,7 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
// funny. Even though the raw_callback is registered with KeyPressMask,
// also KeyRelease-events are passed through:-(
// [It seems that xforms puts them in pairs... (JMarc)]
// [It seems that XForms puts them in pairs... (JMarc)]
if (static_cast<XEvent*>(xev)->type == KeyPress
&& view->bufferview->getWorkArea()->focus
&& view->bufferview->getWorkArea()->active)

View File

@ -43,7 +43,6 @@ struct FD_form_main {
};
/**
This class is the form containing the view of the buffer. The actual buffer
view is supposed (at least IMHO) to be another class, that shows its output
@ -75,6 +74,9 @@ public:
///
BufferView * view() { return bufferview; }
/// returns a pointer to the main form.
FD_form_main * getMainForm() { return _form_main; }
/// returns a pointer to the form.
FL_FORM * getForm() { return _form; }
@ -133,7 +135,7 @@ public:
static void UpdateTimerCB(FL_OBJECT *, long);
private:
/// makes the main form.
FD_form_main * create_form_form_main(int width, int height);
void create_form_form_main(int width, int height);
/// A pointer to the form.
FD_form_main * _form_main;
/// A pointer to the form.

View File

@ -14,9 +14,9 @@
#include "lyx_gui_misc.h"
#include "BufferView.h"
#include "gettext.h"
#include "LyXView.h"
extern FD_form_paper * fd_form_paper;
extern MiniBuffer * minibuffer;
extern BufferView * current_view;
@ -180,7 +180,7 @@ void MenuLayoutPaper()
void PaperApplyCB(FL_OBJECT *, long)
{
if (! current_view->available())
if (!current_view->available())
return;
BufferParams * params = &current_view->buffer()->params;
@ -204,7 +204,7 @@ void PaperApplyCB(FL_OBJECT *, long)
params->headsep = fl_get_input(fd->input_head_sep);
params->footskip = fl_get_input(fd->input_foot_skip);
current_view->buffer()->setPaperStuff();
minibuffer->Set(_("Paper layout set"));
current_view->owner()->getMiniBuffer()->Set(_("Paper layout set"));
current_view->buffer()->markDirty();
return;

View File

@ -12,9 +12,9 @@
#include "lyxparagraph.h"
#include "gettext.h"
#include "lyxtext.h"
#include "LyXView.h"
extern FD_form_paragraph_extra * fd_form_paragraph_extra;
extern MiniBuffer * minibuffer;
extern BufferView * current_view;
extern void BeforeChange();
static bool CheckInputWidth();
@ -198,7 +198,8 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
start_minipage);
current_view->update(1);
minibuffer->Set(_("ParagraphExtra layout set"));
current_view->owner()->getMiniBuffer()->
Set(_("ParagraphExtra layout set"));
}
return;
}

View File

@ -32,9 +32,9 @@
#include "lyxtext.h"
#include "lyx_cb.h"
#include "gettext.h"
#include "LyXView.h"
extern BufferView * current_view;
extern MiniBuffer * minibuffer;
extern void SmallUpdate(signed char);
extern void BeforeChange();
extern int RunLinuxDoc(int, string const &);
@ -127,7 +127,7 @@ bool BufferList::QwriteAll()
// Should probably be moved to somewhere else: BufferView? LyXView?
bool BufferList::write(Buffer * buf, bool makeBackup)
{
minibuffer->Set(_("Saving document"),
current_view->owner()->getMiniBuffer()->Set(_("Saving document"),
MakeDisplayPath(buf->fileName()), "...");
// We don't need autosaves in the immediate future. (Asger)
@ -201,8 +201,9 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
if (buf->writeFile(buf->fileName(), false)) {
buf->markLyxClean();
minibuffer->Set(_("Document saved as"),
MakeDisplayPath(buf->fileName()));
current_view->owner()->getMiniBuffer()->
Set(_("Document saved as"),
MakeDisplayPath(buf->fileName()));
// now delete the autosavefile
string a = OnlyPath(buf->fileName());
@ -222,7 +223,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
string s = buf->fileName() + '~';
rename(s.c_str(), buf->fileName().c_str());
}
minibuffer->Set(_("Save failed!"));
current_view->owner()->getMiniBuffer()->Set(_("Save failed!"));
return false;
}
@ -578,8 +579,9 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
bool ro = false;
switch (IsFileWriteable(s)) {
case 0:
minibuffer->Set(_("File `")+MakeDisplayPath(s, 50)+
_("' is read-only."));
current_view->owner()->getMiniBuffer()->
Set(_("File `")+MakeDisplayPath(s, 50)+
_("' is read-only."));
ro = true;
// Fall through
case 1:

View File

@ -118,7 +118,6 @@ static int gs_allcolors; // number of all colors
static pidwait * pw = 0; // pid wait list
extern FD_form_main * fd_form_main;
extern Colormap color_map;
void addpidwait(int pid)
@ -381,7 +380,7 @@ void InitFigures()
}
fl_add_canvas_handler(figinset_canvas, ClientMessage,
GhostscriptMsg, fd_form_main);
GhostscriptMsg, current_view->owner()->getMainForm());
// now we have to init color_map
if (!color_map) color_map = DefaultColormap(fl_display,
@ -1132,8 +1131,8 @@ void InsetFig::Write(ostream & os)
}
if (!subcaption.empty())
os << "subcaption " << subcaption << "\n";
if (wtype) os << "width " << wtype << " " << xwid << "\n";
if (htype) os << "height " << htype << " " << xhgh << "\n";
if (wtype) os << "width " << static_cast<int>(wtype) << " " << xwid << "\n";
if (htype) os << "height " << static_cast<int>(htype) << " " << xhgh << "\n";
if (angle != 0) os << "angle " << angle << "\n";
os << "flags " << flags << "\n";
if (subfigure) os << "subfigure\n";

View File

@ -62,11 +62,9 @@
#include "gettext.h"
#include "layout.h"
extern MiniBuffer * minibuffer;
extern Combox * combo_language;
extern BufferList bufferlist;
extern void show_symbols_form();
extern FD_form_main * fd_form_main;
extern FD_form_title * fd_form_title;
extern FD_form_paragraph * fd_form_paragraph;
extern FD_form_character * fd_form_character;
@ -226,7 +224,8 @@ void ProhibitInput()
}
/* set the cursor to the watch for all forms and the canvas */
XDefineCursor(fl_display, fd_form_main->form_main->window, cursor);
XDefineCursor(fl_display, current_view->owner()->getForm()->window,
cursor);
if (fd_form_paragraph->form_paragraph->visible)
XDefineCursor(fl_display,
fd_form_paragraph->form_paragraph->window,
@ -262,7 +261,7 @@ void AllowInput()
/* reset the cursor from the watch for all forms and the canvas */
XUndefineCursor(fl_display, fd_form_main->form_main->window);
XUndefineCursor(fl_display, current_view->owner()->getForm()->window);
if (fd_form_paragraph->form_paragraph->visible)
XUndefineCursor(fl_display,
fd_form_paragraph->form_paragraph->window);
@ -270,7 +269,7 @@ void AllowInput()
XUndefineCursor(fl_display,
fd_form_character->form_character->window);
if (current_view->getWorkArea()->belowmouse)
SetXtermCursor(fd_form_main->form_main->window);
SetXtermCursor(current_view->owner()->getForm()->window);
XFlush(fl_display);
fl_activate_all_forms();
@ -287,7 +286,7 @@ void FreeUpdateTimer()
void SetUpdateTimer(float time)
{
fl_set_timer(fd_form_main->timer_update, time);
fl_set_timer(current_view->owner()->getMainForm()->timer_update, time);
updatetimer = 1;
}
@ -321,7 +320,7 @@ void SmallUpdate(signed char f)
if (f == 1 || f == -1) {
if (current_view->buffer()->isLyxClean()) {
current_view->buffer()->markDirty();
minibuffer->setTimer(4);
current_view->owner()->getMiniBuffer()->setTimer(4);
}
else {
current_view->buffer()->markDirty();
@ -379,7 +378,7 @@ void MenuWriteAs(Buffer * buffer)
AllowInput();
if (fname.empty()) {
minibuffer->Set(_("Canceled."));
current_view->owner()->getMiniBuffer()->Set(_("Canceled."));
return;
}
@ -408,7 +407,7 @@ void MenuWriteAs(Buffer * buffer)
buffer->fileName(s);
buffer->markDirty();
minibuffer->Set(_("Document renamed to '"),
current_view->owner()->getMiniBuffer()->Set(_("Document renamed to '"),
MakeDisplayPath(s),
_("', but not saved..."));
}
@ -603,10 +602,12 @@ bool RunScript(Buffer * buffer, bool wait,
#ifdef WITH_WARNINGS
#warning What should we do here?
#endif
minibuffer->Set(_("Executing command:"), cmd);
current_view->owner()->getMiniBuffer()->Set(
_("Executing command:"), cmd);
result = one.startscript(Systemcalls::System, cmd);
} else {
minibuffer->Set(_("Executing command:"), cmd);
current_view->owner()->getMiniBuffer()->Set(
_("Executing command:"), cmd);
result = one.startscript(wait ? Systemcalls::Wait
: Systemcalls::DontWait, cmd);
}
@ -828,19 +829,20 @@ void MenuMakeLaTeX(Buffer * buffer)
!AskQuestion(_("File already exists:"),
MakeDisplayPath(s, 50),
_("Do you want to overwrite the file?"))) {
minibuffer->Set(_("Canceled"));
current_view->owner()->getMiniBuffer()->Set(_("Canceled"));
return;
}
if (buffer->isDocBook())
minibuffer->Set(_("DocBook does not have a latex backend"));
current_view->owner()->getMiniBuffer()->Set(
_("DocBook does not have a latex backend"));
else {
if (buffer->isLinuxDoc())
RunLinuxDoc(0, buffer->fileName());
else
buffer->makeLaTeXFile(s, string(), true);
minibuffer->Set(_("Nice LaTeX file saved as"),
MakeDisplayPath(s));
current_view->owner()->getMiniBuffer()->Set(
_("Nice LaTeX file saved as"), MakeDisplayPath(s));
buffer->markDviDirty();
}
}
@ -864,17 +866,17 @@ void MenuMakeLinuxDoc(Buffer * buffer)
!AskQuestion(_("File already exists:"),
MakeDisplayPath(s, 50),
_("Do you want to overwrite the file?"))) {
minibuffer->Set(_("Canceled"));
current_view->owner()->getMiniBuffer()->Set(_("Canceled"));
return;
}
minibuffer->Set(_("Building LinuxDoc SGML file `"),
MakeDisplayPath(s), "'...");
current_view->owner()->getMiniBuffer()->Set(
_("Building LinuxDoc SGML file `"), MakeDisplayPath(s),"'...");
buffer->makeLinuxDocFile(s, 65);
buffer->redraw();
minibuffer->Set(_("LinuxDoc SGML file save as"),
MakeDisplayPath(s));
current_view->owner()->getMiniBuffer()->Set(
_("LinuxDoc SGML file save as"), MakeDisplayPath(s));
}
@ -897,16 +899,16 @@ void MenuMakeDocBook(Buffer * buffer)
!AskQuestion(_("File already exists:"),
MakeDisplayPath(s, 50),
_("Do you want to overwrite the file?"))) {
minibuffer->Set(_("Canceled"));
current_view->owner()->getMiniBuffer()->Set(_("Canceled"));
return;
}
minibuffer->Set(_("Building DocBook SGML file `"),
current_view->owner()->getMiniBuffer()->Set(_("Building DocBook SGML file `"),
MakeDisplayPath(s), "'...");
buffer->makeDocBookFile(s, 65);
buffer->redraw();
minibuffer->Set(_("DocBook SGML file save as"),
current_view->owner()->getMiniBuffer()->Set(_("DocBook SGML file save as"),
MakeDisplayPath(s));
}
@ -924,13 +926,13 @@ void MenuMakeAscii(Buffer * buffer)
!AskQuestion(_("File already exists:"),
MakeDisplayPath(s, 50),
_("Do you want to overwrite the file?"))) {
minibuffer->Set(_("Canceled"));
current_view->owner()->getMiniBuffer()->Set(_("Canceled"));
return;
}
buffer->writeFileAscii(s, lyxrc->ascii_linelen);
minibuffer->Set(_("Ascii file saved as"), MakeDisplayPath(s));
current_view->owner()->getMiniBuffer()->Set(_("Ascii file saved as"), MakeDisplayPath(s));
}
@ -973,10 +975,10 @@ void MenuMakeHTML(Buffer * buffer)
Systemcalls one;
int res = one.startscript(Systemcalls::System, tmp);
if (res == 0) {
minibuffer->Set(_("Document exported as HTML to file `")
current_view->owner()->getMiniBuffer()->Set(_("Document exported as HTML to file `")
+ MakeDisplayPath(result) +'\'');
} else {
minibuffer->Set(_("Unable to convert to HTML the file `")
current_view->owner()->getMiniBuffer()->Set(_("Unable to convert to HTML the file `")
+ MakeDisplayPath(infile)
+ '\'');
}
@ -1032,7 +1034,7 @@ void MenuExport(Buffer * buffer, string const & extyp)
MenuMakeHTML(buffer);
}
else {
minibuffer->Set(_("Unknown export type: ")+ extyp);
current_view->owner()->getMiniBuffer()->Set(_("Unknown export type: ")+ extyp);
}
}
@ -1077,7 +1079,7 @@ void AutoSave()
return;
}
minibuffer->Set(_("Autosaving current document..."));
current_view->owner()->getMiniBuffer()->Set(_("Autosaving current document..."));
// create autosave filename
string fname = OnlyPath(current_view->buffer()->fileName());
@ -1117,7 +1119,7 @@ void AutoSave()
// It is dangerous to do this in the child,
// but safe in the parent, so...
if (pid == -1)
minibuffer->Set(_("Autosave Failed!"));
current_view->owner()->getMiniBuffer()->Set(_("Autosave Failed!"));
}
}
if (pid == 0) { // we are the child so...
@ -1288,7 +1290,7 @@ void MenuPasteSelection(char at)
return;
XConvertSelection(fl_display,
XA_PRIMARY, XA_STRING, data_prop,
fd_form_main->form_main->window, 0);
current_view->owner()->getForm()->window, 0);
XFlush(fl_display);
}
@ -1299,7 +1301,7 @@ extern "C" void FootCB(FL_OBJECT *, long)
if (!current_view->available())
return;
minibuffer->Set(_("Inserting Footnote..."));
current_view->owner()->getMiniBuffer()->Set(_("Inserting Footnote..."));
current_view->getScreen()->HideCursor();
current_view->update(-2);
current_view->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
@ -1363,7 +1365,7 @@ int RunLinuxDoc(int flag, string const & filename)
Systemcalls one;
switch (flag) {
case -1: /* Import file */
minibuffer->Set(_("Importing LinuxDoc SGML file `"),
current_view->owner()->getMiniBuffer()->Set(_("Importing LinuxDoc SGML file `"),
MakeDisplayPath(filename), "'...");
s2 = "sgml2lyx " + lyxrc->sgml_extra_options + ' '
+ name;
@ -1371,14 +1373,14 @@ int RunLinuxDoc(int flag, string const & filename)
errorcode = 1;
break;
case 0: /* TeX output asked */
minibuffer->Set(_("Converting LinuxDoc SGML to TeX file..."));
current_view->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to TeX file..."));
s2 = "sgml2latex " + add_flags + " -o tex "
+ lyxrc->sgml_extra_options + ' ' + name;
if (one.startscript(Systemcalls::System, s2))
errorcode = 1;
break;
case 1: /* dvi output asked */
minibuffer->Set(_("Converting LinuxDoc SGML to dvi file..."));
current_view->owner()->getMiniBuffer()->Set(_("Converting LinuxDoc SGML to dvi file..."));
s2 = "sgml2latex " + add_flags + " -o dvi "
+ lyxrc->sgml_extra_options + ' ' + name;
if (one.startscript(Systemcalls::System, s2)) {
@ -1431,7 +1433,7 @@ int RunDocBook(int flag, string const & filename)
switch (flag) {
case 1: /* dvi output asked */
{
minibuffer->Set(_("Converting DocBook SGML to dvi file..."));
current_view->owner()->getMiniBuffer()->Set(_("Converting DocBook SGML to dvi file..."));
string s2 = "sgmltools --backend dvi " + name;
if (one.startscript(Systemcalls::System, s2)) {
errorcode = 1;
@ -2134,7 +2136,7 @@ void NoteCB()
void OpenStuff()
{
if (current_view->available()) {
minibuffer->Set(_("Open/Close..."));
current_view->owner()->getMiniBuffer()->Set(_("Open/Close..."));
current_view->getScreen()->HideCursor();
BeforeChange();
current_view->update(-2);
@ -2148,7 +2150,7 @@ void OpenStuff()
void ToggleFloat()
{
if (current_view->available()) {
minibuffer->Set(_("Open/Close..."));
current_view->owner()->getMiniBuffer()->Set(_("Open/Close..."));
current_view->getScreen()->HideCursor();
BeforeChange();
current_view->update(-2);
@ -2162,17 +2164,17 @@ void ToggleFloat()
void MenuUndo()
{
/* if (current_view->buffer()->the_locking_inset) {
minibuffer->Set(_("Undo not yet supported in math mode"));
current_view->owner()->getMiniBuffer()->Set(_("Undo not yet supported in math mode"));
return;
}*/
if (current_view->available()) {
minibuffer->Set(_("Undo"));
current_view->owner()->getMiniBuffer()->Set(_("Undo"));
current_view->getScreen()->HideCursor();
BeforeChange();
current_view->update(-2);
if (!current_view->text->TextUndo())
minibuffer->Set(_("No further undo information"));
current_view->owner()->getMiniBuffer()->Set(_("No further undo information"));
else
current_view->update(-1);
}
@ -2183,17 +2185,17 @@ void MenuUndo()
void MenuRedo()
{
if (current_view->buffer()->the_locking_inset) {
minibuffer->Set(_("Redo not yet supported in math mode"));
current_view->owner()->getMiniBuffer()->Set(_("Redo not yet supported in math mode"));
return;
}
if (current_view->available()) {
minibuffer->Set(_("Redo"));
current_view->owner()->getMiniBuffer()->Set(_("Redo"));
current_view->getScreen()->HideCursor();
BeforeChange();
current_view->update(-2);
if (!current_view->text->TextRedo())
minibuffer->Set(_("No further redo information"));
current_view->owner()->getMiniBuffer()->Set(_("No further redo information"));
else
current_view->update(-1);
}
@ -2423,7 +2425,7 @@ void ToggleAndShow(LyXFont const & font)
extern "C" void MarginCB(FL_OBJECT *, long)
{
if (current_view->available()) {
minibuffer->Set(_("Inserting margin note..."));
current_view->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
current_view->getScreen()->HideCursor();
current_view->update(-2);
current_view->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
@ -2465,7 +2467,7 @@ void CopyEnvironmentCB()
current_view->getScreen()->ToggleSelection();
current_view->text->ClearSelection();
current_view->update(-2);
minibuffer->Set(_("Paragraph environment type copied"));
current_view->owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
}
}
@ -2475,7 +2477,7 @@ void PasteEnvironmentCB()
{
if (current_view->available()) {
current_view->text->pasteEnvironmentType();
minibuffer->Set(_("Paragraph environment type set"));
current_view->owner()->getMiniBuffer()->Set(_("Paragraph environment type set"));
current_view->update(1);
}
}
@ -2490,7 +2492,7 @@ void CopyCB()
current_view->getScreen()->ToggleSelection();
current_view->text->ClearSelection();
current_view->update(-2);
minibuffer->Set(_("Copy"));
current_view->owner()->getMiniBuffer()->Set(_("Copy"));
}
}
@ -2503,7 +2505,7 @@ void CutCB()
current_view->update(-2);
current_view->text->CutSelection();
current_view->update(1);
minibuffer->Set(_("Cut"));
current_view->owner()->getMiniBuffer()->Set(_("Cut"));
}
}
@ -2513,7 +2515,7 @@ void PasteCB()
{
if (!current_view->available()) return;
minibuffer->Set(_("Paste"));
current_view->owner()->getMiniBuffer()->Set(_("Paste"));
current_view->getScreen()->HideCursor();
/* clear the selection */
current_view->getScreen()->ToggleSelection();
@ -2536,7 +2538,7 @@ extern "C" void MeltCB(FL_OBJECT *, long)
{
if (!current_view->available()) return;
minibuffer->Set(_("Melt"));
current_view->owner()->getMiniBuffer()->Set(_("Melt"));
current_view->getScreen()->HideCursor();
BeforeChange();
current_view->update(-2);
@ -2571,7 +2573,7 @@ extern "C" void DepthCB(FL_OBJECT * ob, long decInc)
else
current_view->text->DecDepth();
current_view->update(1);
minibuffer->Set(_("Changed environment depth"
current_view->owner()->getMiniBuffer()->Set(_("Changed environment depth"
" (in possible range, maybe not)"));
}
}
@ -2808,7 +2810,7 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
labelwidthstring,
noindent);
current_view->update(1);
minibuffer->Set(_("Paragraph layout set"));
current_view->owner()->getMiniBuffer()->Set(_("Paragraph layout set"));
}
@ -2991,7 +2993,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
if (textclasslist.Load(new_class)) {
// successfully loaded
redo = true;
minibuffer->Set(_("Converting document to new document class..."));
current_view->owner()->getMiniBuffer()->Set(_("Converting document to new document class..."));
int ret = current_view->text->
SwitchLayoutsBetweenClasses(current_view->buffer()->
params.textclass,
@ -3094,7 +3096,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
if (redo)
current_view->redoCurrentBuffer();
minibuffer->Set(_("Document layout set"));
current_view->owner()->getMiniBuffer()->Set(_("Document layout set"));
current_view->buffer()->markDirty();
params->options =
@ -3145,11 +3147,11 @@ void GotoNote()
current_view->text->cursor.pos = 0;
if (!current_view->text->GotoNextNote()) {
current_view->text->cursor = tmp;
minibuffer->Set(_("No more notes"));
current_view->owner()->getMiniBuffer()->Set(_("No more notes"));
LyXBell();
}
} else {
minibuffer->Set(_("No more notes"));
current_view->owner()->getMiniBuffer()->Set(_("No more notes"));
LyXBell();
}
}
@ -3181,7 +3183,7 @@ extern "C" void QuotesApplyCB(FL_OBJECT *, long)
if (!current_view->available())
return;
minibuffer->Set(_("Quotes type set"));
current_view->owner()->getMiniBuffer()->Set(_("Quotes type set"));
//current_view->buffer()->params.quotes_language =
// fl_get_choice(fd_form_quotes->choice_quotes_language) - 1;
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
@ -3245,7 +3247,7 @@ extern "C" void PreambleApplyCB(FL_OBJECT *, long)
current_view->buffer()->params.preamble =
fl_get_input(fd_form_preamble->input_preamble);
current_view->buffer()->markDirty();
minibuffer->Set(_("LaTeX preamble set"));
current_view->owner()->getMiniBuffer()->Set(_("LaTeX preamble set"));
}
@ -3271,7 +3273,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
return;
}
minibuffer->Set(_("Inserting table..."));
current_view->owner()->getMiniBuffer()->Set(_("Inserting table..."));
int ysize = int(fl_get_slider_value(fd_form_table->slider_columns) + 0.5);
int xsize = int(fl_get_slider_value(fd_form_table->slider_rows) + 0.5);
@ -3333,7 +3335,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
current_view->text->UnFreezeUndo();
current_view->update(1);
minibuffer->Set(_("Table inserted"));
current_view->owner()->getMiniBuffer()->Set(_("Table inserted"));
}
@ -3540,12 +3542,12 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
if(buffer->isReadonly()) // paranoia
return;
minibuffer->Set(_("Inserting figure..."));
current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
if (fl_get_button(fd_form_figure->radio_inline)
|| current_view->text->cursor.par->table) {
InsetFig * new_inset = new InsetFig(100, 20, buffer);
buffer->insertInset(new_inset);
minibuffer->Set(_("Figure inserted"));
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
new_inset->Edit(0, 0);
return;
}
@ -3596,7 +3598,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
buffer->insertInset(new_inset);
new_inset->Edit(0, 0);
current_view->update(0);
minibuffer->Set(_("Figure inserted"));
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
current_view->text->UnFreezeUndo();
}
@ -3626,7 +3628,7 @@ extern "C" void ScreenApplyCB(FL_OBJECT *, long)
// All buffers will need resize
bufferlist.resize();
minibuffer->Set(_("Screen options set"));
current_view->owner()->getMiniBuffer()->Set(_("Screen options set"));
}
@ -3665,14 +3667,14 @@ void LaTeXOptions()
// reconfigure the automatic settings.
void Reconfigure()
{
minibuffer->Set(_("Running configure..."));
current_view->owner()->getMiniBuffer()->Set(_("Running configure..."));
// Run configure in user lyx directory
Path p(user_lyxdir);
Systemcalls one(Systemcalls::System,
AddName(system_lyxdir, "configure"));
p.pop();
minibuffer->Set(_("Reloading configuration..."));
current_view->owner()->getMiniBuffer()->Set(_("Reloading configuration..."));
lyxrc->read(LibFileSearch(string(), "lyxrc.defaults"));
WriteAlert(_("The system has been reconfigured."),
_("You need to restart LyX to make use of any"),
@ -4040,7 +4042,7 @@ void UpdateInset(Inset * inset, bool mark_dirty)
current_view->update();
if (mark_dirty){
if (current_view->buffer()->isLyxClean())
minibuffer->setTimer(4);
current_view->owner()->getMiniBuffer()->setTimer(4);
current_view->buffer()->markDirty();
}
current_view->updateScrollbar();

View File

@ -30,8 +30,8 @@
#include "print_form.h"
#include "sp_form.h"
#include "insets/insetindex.h"
#include "LyXView.h"
extern MiniBuffer *minibuffer;
extern BufferView *current_view;
extern FD_form_paragraph * fd_form_paragraph;
@ -341,6 +341,9 @@ const char* flyx_ident_extract(char const *sc)
//
void WriteAlert(string const & s1, string const & s2, string const & s3)
{
MiniBuffer * minibuffer = 0;
if (current_view && current_view->owner())
minibuffer = current_view->owner()->getMiniBuffer();
if (minibuffer) {
ProhibitInput();
minibuffer->Set(s1, s2, s3);

View File

@ -36,7 +36,6 @@
#include "support/textutils.h"
extern BufferView * current_view; // called too many times in this file...
extern MiniBuffer * minibuffer;
// Maximum length copied from the current selection to the search string
const int LYXSEARCH_MAXLEN = 128;
@ -214,14 +213,16 @@ void LyXFindReplace1::SearchReplaceAllCB()
} while( SearchCB(true) );
if( replace_count == 0 ) {
LyXBell();
minibuffer->Set(_("String not found!"));
current_view->owner()->getMiniBuffer()->Set(
_("String not found!"));
} else {
if( replace_count == 1 ) {
minibuffer->Set(_("1 string has been replaced."));
if (replace_count == 1) {
current_view->owner()->getMiniBuffer()->Set(
_("1 string has been replaced."));
} else {
string str = tostr(replace_count);
str += _(" strings have been replaced.");
minibuffer->Set(str);
current_view->owner()->getMiniBuffer()->Set(str);
}
}
}
@ -257,11 +258,11 @@ bool LyXFindReplace1::SearchCB(bool fForward)
// set the new selection
SetSelectionOverLenChars(current_view->text, iLenSelected);
current_view->getScreen()->ToggleSelection(false);
minibuffer->Set(_("Found."));
current_view->owner()->getMiniBuffer()->Set(_("Found."));
result = true;
} else {
LyXBell();
minibuffer->Set(_("String not found!"));
current_view->owner()->getMiniBuffer()->Set(_("String not found!"));
result = false;
}

View File

@ -39,10 +39,10 @@
#include "debug.h"
#include "lyx_gui_misc.h"
#include "support/LOstream.h"
#include "LyXView.h"
extern void UpdateInset(Inset * inset, bool mark_dirty = true);
extern void LockedInsetStoreUndo(Undo::undo_kind);
extern MiniBuffer * minibuffer;
extern void ShowLockedInsetCursor(long, long, int, int);
extern void HideLockedInsetCursor(long, long, int, int);
extern void FitLockedInsetCursor(long, long, int, int);
@ -871,7 +871,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
{
if (!greek_kb_flag) {
greek_kb_flag = 1;
minibuffer->Set(_("Math greek mode on"));
current_view->owner()->getMiniBuffer()->Set(_("Math greek mode on"));
} else
greek_kb_flag = 0;
break;
@ -882,9 +882,9 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
{
greek_kb_flag = (greek_kb_flag) ? 0 : 2;
if (greek_kb_flag)
minibuffer->Set(_("Math greek keyboard on"));
current_view->owner()->getMiniBuffer()->Set(_("Math greek keyboard on"));
else
minibuffer->Set(_("Math greek keyboard off"));
current_view->owner()->getMiniBuffer()->Set(_("Math greek keyboard off"));
break;
}
@ -899,7 +899,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
{
// varcode = LM_TC_TEX;
mathcursor->setLastCode(LM_TC_TEX);
minibuffer->Set(_("TeX mode"));
current_view->owner()->getMiniBuffer()->Set(_("TeX mode"));
break;
}
@ -914,10 +914,10 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
if (!label.empty()) {
label.clear();
}
minibuffer->Set(_("No number"));
current_view->owner()->getMiniBuffer()->Set(_("No number"));
} else {
type++;
minibuffer->Set(_("Number"));
current_view->owner()->getMiniBuffer()->Set(_("Number"));
}
par->SetType(type);
UpdateLocal();
@ -1075,7 +1075,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
case LFUN_MATH_MODE:
{
if (mathcursor->getLastCode()!= LM_TC_TEXTRM) {
minibuffer->Set(_("math text mode"));
current_view->owner()->getMiniBuffer()->Set(_("math text mode"));
varcode = LM_TC_TEXTRM;
} else {
varcode = LM_TC_VAR;
@ -1084,12 +1084,12 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
break;
}
case LFUN_UNDO:
minibuffer->Set(_("Invalid action in math mode!"));
current_view->owner()->getMiniBuffer()->Set(_("Invalid action in math mode!"));
break;
//------- dummy actions
case LFUN_EXEC_COMMAND:
minibuffer->ExecCommand();
current_view->owner()->getMiniBuffer()->ExecCommand();
break;
default:
@ -1190,7 +1190,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
if (c == '\\') {
if (was_macro)
mathcursor->MacroModeClose();
minibuffer->Set(_("TeX mode"));
current_view->owner()->getMiniBuffer()->Set(_("TeX mode"));
mathcursor->setLastCode(LM_TC_TEX);
}
UpdateLocal();

View File

@ -44,7 +44,6 @@ extern void BeforeChange();
extern void Update(signed char);
extern int UnlockInset(UpdatableInset *);
extern short greek_kb_flag;
extern MiniBuffer * minibuffer;
extern BufferView * current_view;
@ -307,7 +306,7 @@ extern "C" void math_cb(FL_OBJECT* ob, long data)
if (s) {
if (current_view->available() && lyxrc->display_shortcuts) {
minibuffer->Set("Inserting symbol ", s);
current_view->owner()->getMiniBuffer()->Set("Inserting symbol ", s);
}
current_view->owner()->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, s);
}

View File

@ -12,6 +12,50 @@
using std::count;
using std::transform;
int compare_no_case(string const & s, string const & s2)
{
// ANSI C
string::const_iterator p = s.begin();
string::const_iterator p2 = s2.begin();
while (p != s.end() && p2 != s2.end()) {
int const lc1 = tolower(*p);
int const lc2 = tolower(*p2);
if (lc1 != lc2)
return (lc1 < lc2) ? -1 : 1;
++p;
++p2;
}
if (s.size() == s2.size())
return 0;
if (s.size() < s2.size())
return -1;
return 1;
}
int compare_no_case(string const & s, string const & s2, unsigned int len)
{
//#warning verify this func please
string::const_iterator p = s.begin();
string::const_iterator p2 = s2.begin();
unsigned int i = 0;
while (i < len && p != s.end() && p2 != s2.end()) {
int const lc1 = tolower(*p);
int const lc2 = tolower(*p2);
if (lc1 != lc2)
return (lc1 < lc2) ? -1 : 1;
++i;
++p;
++p2;
}
if (s.size() == s2.size())
return 0;
if (s.size() < s2.size())
return -1;
return 1;
}
bool isStrInt(string const & str)
{
if (str.empty()) return false;

View File

@ -42,41 +42,10 @@ T * lstrchr(T const * t, int c)
///
inline int compare_no_case(string const & s, string const & s2)
{
// ANSI C
string::const_iterator p = s.begin();
string::const_iterator p2 = s2.begin();
while (p != s.end() && p2 != s2.end()) {
if (tolower(*p) != tolower(*p2))
return (tolower(*p) < tolower(*p2)) ? -1 : 1;
++p;
++p2;
}
return s.size() - s2.size();
}
int compare_no_case(string const & s, string const & s2);
///
inline int compare_no_case(string const & s, string const & s2,
unsigned int len)
{
//#warning verify this func please
string::const_iterator p = s.begin();
string::const_iterator p2 = s2.begin();
unsigned int i = 0;
while (i < len && p != s.end() && p2 != s2.end()) {
if (tolower(*p) != tolower(*p2))
return (tolower(*p) < tolower(*p2)) ? -1 : 1;
++i;
++p;
++p2;
}
return s.size() - s2.size();
}
int compare_no_case(string const & s, string const & s2, unsigned int len);
///
inline int compare(char const * a, char const * b)

View File

@ -64,6 +64,7 @@ SystemcallsSingletoncontroller::addCall(Systemcalls const &newcall) {
void
SystemcallsSingletoncontroller::timer() {
lyxerr << "Tick" << endl;
// check each entry of our list, if it's finished
ControlledCalls *prev = 0;
for (ControlledCalls *actCall= sysCalls; actCall; actCall= actCall->next)

View File

@ -28,6 +28,7 @@
#include "lyxscreen.h"
#include "minibuffer.h"
#include "debug.h"
#include "LyXView.h"
static const int LYX_PAPER_MARGIN = 20;
@ -40,9 +41,6 @@ extern int UnlockInset(UpdatableInset * inset);
// ale070405
extern int bibitemMaxWidth(LyXFont const &);
// dnaber 1999-02-02
extern MiniBuffer * minibuffer;
int LyXText::SingleWidth(LyXParagraph * par,
LyXParagraph::size_type pos)
{
@ -61,7 +59,7 @@ int LyXText::SingleWidth(LyXParagraph * par,
return font.width(c);
} else if (IsHfillChar(c)) {
return 3; /* because of the representation
return 3; /* Because of the representation
* as vertical lines */
} else if (c == LyXParagraph::META_FOOTNOTE ||
@ -116,8 +114,7 @@ int LyXText::SingleWidth(LyXParagraph * par,
}
/* returns the paragraph position of the last character in the
* specified row */
// Returns the paragraph position of the last character in the specified row
LyXParagraph::size_type LyXText::RowLast(Row * row)
{
if (row->next == 0)
@ -2237,7 +2234,7 @@ void LyXText::InsertChar(char c)
* blank at the end of a row we have to force
* a rebreak.*/
minibuffer->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
current_view->owner()->getMiniBuffer()->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
if (cursor.pos == RowLast(cursor.row)
&& !IsLineSeparatorChar(c))
cursor.row->fill = -1; /* force rebreak */
@ -2254,9 +2251,9 @@ void LyXText::InsertChar(char c)
&& cursor.par->Previous()->footnoteflag
== LyXParagraph::OPEN_FOOTNOTE))) {
if (cursor.pos == 0 )
minibuffer->Set(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
current_view->owner()->getMiniBuffer()->Set(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
else
minibuffer->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
current_view->owner()->getMiniBuffer()->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
charInserted();
return;
}

View File

@ -32,11 +32,13 @@
#include "lyx_gui_misc.h"
#include "lyxtext.h"
#include "gettext.h"
#include "BufferView.h"
#include "LyXView.h"
extern BufferView * current_view;
using std::copy;
extern MiniBuffer * minibuffer;
// Constructor
LyXText::LyXText(int pw, Buffer * p)
{
@ -181,7 +183,7 @@ void LyXText::SetCharFont(LyXParagraph * par,
LyXParagraph::size_type pos,
LyXFont font)
{
/* let the insets convert their font */
// Let the insets convert their font
if (par->GetChar(pos) == LyXParagraph::META_INSET) {
if (par->GetInset(pos))
font = par->GetInset(pos)->ConvertFont(font);
@ -330,10 +332,10 @@ void LyXText::ToggleFootnote()
LyXParagraph * par = cursor.par->ParFromPos(cursor.pos);
if (par->next && par->next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE){
OpenFootnote();
minibuffer->Set(_("Opened float"));
current_view->owner()->getMiniBuffer()->Set(_("Opened float"));
}
else {
minibuffer->Set(_("Closed float"));
current_view->owner()->getMiniBuffer()->Set(_("Closed float"));
CloseFootnote();
}
}
@ -347,7 +349,7 @@ void LyXText::OpenStuff()
else if (cursor.pos < cursor.par->Last()
&& cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
&& cursor.par->GetInset(cursor.pos)->Editable()) {
minibuffer->Set(cursor.par->GetInset(cursor.pos)->EditMessage());
current_view->owner()->getMiniBuffer()->Set(cursor.par->GetInset(cursor.pos)->EditMessage());
if (cursor.par->GetInset(cursor.pos)->Editable() != 2)
SetCursorParUndo();
cursor.par->GetInset(cursor.pos)->Edit(0, 0);
@ -371,7 +373,7 @@ void LyXText::CloseFootnote()
if (!par->next
|| par->next->footnoteflag != LyXParagraph::OPEN_FOOTNOTE) {
minibuffer->Set(_("Nothing to do"));
current_view->owner()->getMiniBuffer()->Set(_("Nothing to do"));
return;
}
@ -1046,7 +1048,7 @@ void LyXText::ToggleFree(LyXFont font, bool toggleall)
// If the mask is completely neutral, tell user
if (font == LyXFont(LyXFont::ALL_IGNORE)){
// Could only happen with user style
minibuffer->Set(_("No font change defined. Use Character under"
current_view->owner()->getMiniBuffer()->Set(_("No font change defined. Use Character under"
" the Layout menu to define font change."));
return;
}
@ -1057,7 +1059,7 @@ void LyXText::ToggleFree(LyXFont font, bool toggleall)
// Set font
SetFont(font, toggleall);
//minibuffer->Set(_("Font style changed"));
//current_view->owner()->getMiniBuffer()->Set(_("Font style changed"));
/* Implicit selections are cleared afterwards and cursor is set to the
original position. */