#include <cstdlib>
#include "LString.h"
+#include "support/lstrings.h"
#include "lyx_main.h"
#include FORMS_H_LOCATION
#include "lyx.h"
#include "combox.h"
#include "bufferlist.h"
#include "support/filetools.h"
-#include "pathstack.h"
+#include "support/path.h"
#include "filedlg.h"
#include "lyx_gui_misc.h"
#include "LyXView.h" // only because of form_main
s = _("One error detected");
t = _("You should try to fix it.");
} else {
- s += ret;
+ s += tostr(ret);
s += _(" errors detected.");
t = _("You should try to fix them.");
}
s = _("One error detected");
t = _("You should try to fix it.");
} else {
- s += ret;
+ s += tostr(ret);
s += _(" errors detected.");
t = _("You should try to fix them.");
}
s = _("One warning found.");
t = _("Use 'Edit->Go to Error' to find it.");
} else {
- s += ret;
+ s += tostr(ret);
s += _(" warnings found.");
t = _("Use 'Edit->Go to Error' to find them.");
}
path = buffer->tmppath;
}
if (!buffer->isDviClean()) {
- PathPush(path);
+ Path p(path);
ret = MenuRunLaTeX(buffer);
- PathPop();
}
return ret;
}
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
path = buffer->tmppath;
}
- PathPush(path);
+ Path p(path);
cmd = command + ' ' + SpaceLess(name);
Systemcalls one;
result = one.startscript(wait ? Systemcalls::Wait
: Systemcalls::DontWait, cmd);
}
- PathPop();
return (result==0);
}
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
path = buffer->tmppath;
}
- PathPush(path);
+ Path p(path);
bool ret = RunScript(buffer, wait, command);
AllowInput();
- PathPop();
return ret;
}
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
path = buffer->tmppath;
}
- PathPush(path);
+ Path p(path);
bool ret = RunScript(buffer, false, lyxrc->view_ps_command, ps);
- PathPop();
AllowInput();
return ret;
}
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
path = buffer->tmppath;
}
- PathPush(path);
+ Path p(path);
if (!lyxrc->fax_program.empty()) {
string help2 = lyxrc->fax_program;
subst(help2, "$$FName",ps);
Systemcalls one(Systemcalls::System, help2);
} else
send_fax(ps,lyxrc->fax_command);
- PathPop();
}
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
path = buffer->tmppath;
}
- PathPush(path);
+ Path p(path);
// Run dvi-viewer
string command = lyxrc->view_dvi_command + paper ;
bool ret = RunScript(buffer, false, command);
- PathPop();
return ret;
}
}
else {
fl_show_form(fd_form_print->form_print,
- FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
+ FL_PLACE_MOUSE, FL_FULLBORDER,
_("Print"));
}
}
void MenuShowTableOfContents()
{
+ static int ow = -1, oh;
+
TocUpdateCB(0, 0);
if (fd_form_toc->form_toc->visible) {
fl_raise_form(fd_form_toc->form_toc);
fl_show_form(fd_form_toc->form_toc,
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
_("Table Of Contents"));
+ if (ow < 0) {
+ ow = fd_form_toc->form_toc->w;
+ oh = fd_form_toc->form_toc->h;
+ }
+ fl_set_form_minsize(fd_form_toc->form_toc,ow,oh);
}
}
void MenuInsertRef()
{
+ static int ow = -1, oh;
+
RefUpdateCB(0, 0);
if (fd_form_ref->form_ref->visible) {
fl_raise_form(fd_form_ref->form_ref);
fl_show_form(fd_form_ref->form_ref,
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
_("Insert Reference"));
+ if (ow < 0) {
+ ow = fd_form_ref->form_ref->w;
+ oh = fd_form_ref->form_ref->h;
+ }
+ fl_set_form_minsize(fd_form_ref->form_ref,ow,oh);
}
}
}
-void FootCB(FL_OBJECT*, long)
+extern "C" void FootCB(FL_OBJECT*, long)
{
if (!current_view->available())
return;
void LayoutsCB(int sel, void *)
{
- string tmp;
- tmp += sel;
+ string tmp = tostr(sel);
current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
tmp.c_str());
}
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
path = current_view->currentBuffer()->tmppath;
}
- PathPush (path);
+ Path p(path);
if (flag != -1) {
if (!current_view->available())
break;
}
- PathPop();
AllowInput();
current_view->currentBuffer()->redraw();
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
path = current_view->currentBuffer()->tmppath;
}
- PathPush (path);
+ Path p(path);
if (!current_view->available())
return 0;
break;
}
- PathPop();
AllowInput();
current_view->currentBuffer()->redraw();
void MenuLayoutCharacter()
{
+ static int ow = -1, oh;
+
if (fd_form_character->form_character->visible) {
fl_raise_form(fd_form_character->form_character);
} else {
fl_show_form(fd_form_character->form_character,
FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER,
_("Character Style"));
+ if (ow < 0) {
+ ow = fd_form_character->form_character->w;
+ oh = fd_form_character->form_character->h;
+ }
+ fl_set_form_minsize(fd_form_character->form_character,ow,oh);
}
}
fl_raise_form(fd_form_paragraph->form_paragraph);
} else {
fl_show_form(fd_form_paragraph->form_paragraph,
- FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER,
+ FL_PLACE_MOUSE, FL_FULLBORDER,
_("Paragraph Environment"));
}
}
fl_raise_form(fd_form_document->form_document);
} else {
fl_show_form(fd_form_document->form_document,
- FL_PLACE_MOUSE | FL_FREE_SIZE,
- FL_FULLBORDER,
+ FL_PLACE_MOUSE, FL_FULLBORDER,
_("Document Layout"));
}
}
fl_raise_form(fd_form_quotes->form_quotes);
} else {
fl_show_form(fd_form_quotes->form_quotes,
- FL_PLACE_MOUSE | FL_FREE_SIZE,
- FL_FULLBORDER,
+ FL_PLACE_MOUSE, FL_FULLBORDER,
_("Quotes"));
}
}
void MenuLayoutPreamble()
{
+ static int ow = -1, oh;
+
if (UpdateLayoutPreamble()) {
if (fd_form_preamble->form_preamble->visible) {
fl_raise_form(fd_form_preamble->form_preamble);
FL_PLACE_MOUSE | FL_FREE_SIZE,
FL_FULLBORDER,
_("LaTeX Preamble"));
+ if (ow < 0) {
+ ow = fd_form_preamble->form_preamble->w;
+ oh = fd_form_preamble->form_preamble->h;
+ }
+ fl_set_form_minsize(fd_form_preamble->form_preamble,
+ ow,oh);
}
}
}
}
-void MarginCB(FL_OBJECT *, long)
+extern "C" void MarginCB(FL_OBJECT *, long)
{
if (current_view->available()) {
minibuffer->Set(_("Inserting margin note..."));
}
-void FigureCB(FL_OBJECT *, long)
+extern "C" void FigureCB(FL_OBJECT *, long)
{
if (fd_form_figure->form_figure->visible) {
fl_raise_form(fd_form_figure->form_figure);
}
-void TableCB(FL_OBJECT *, long)
+extern "C" void TableCB(FL_OBJECT *, long)
{
if (fd_form_table->form_table->visible) {
fl_raise_form(fd_form_table->form_table);
} else {
fl_show_form(fd_form_table->form_table,
- FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
+ FL_PLACE_MOUSE, FL_FULLBORDER,
_("Insert Table"));
}
}
}
-void MeltCB(FL_OBJECT *, long)
+extern "C" void MeltCB(FL_OBJECT *, long)
{
if (!current_view->available()) return;
// if decInc == 0, depth change taking mouse button number into account
// if decInc == 1, increment depth
// if decInc == -1, decrement depth
-void DepthCB(FL_OBJECT *ob, long decInc)
+extern "C" void DepthCB(FL_OBJECT *ob, long decInc)
{
int button = 1;
/* callbacks for form form_title */
-void TimerCB(FL_OBJECT *, long)
+extern "C" void TimerCB(FL_OBJECT *, long)
{
// only if the form still exists
if (fd_form_title->form_title != 0) {
/* callbacks for form form_paragraph */
-void ParagraphVSpaceCB(FL_OBJECT* obj, long )
+extern "C" void ParagraphVSpaceCB(FL_OBJECT* obj, long )
{
// "Synchronize" the choices and input fields, making it
// impossible to commit senseless data.
}
-void ParagraphApplyCB(FL_OBJECT *, long)
+extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
{
if (!current_view->available())
return;
}
-void ParagraphCancelCB(FL_OBJECT *, long)
+extern "C" void ParagraphCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_paragraph->form_paragraph);
}
-void ParagraphOKCB(FL_OBJECT *ob, long data)
+extern "C" void ParagraphOKCB(FL_OBJECT *ob, long data)
{
ParagraphApplyCB(ob, data);
ParagraphCancelCB(ob, data);
/* callbacks for form form_character */
-void CharacterApplyCB(FL_OBJECT *, long)
+extern "C" void CharacterApplyCB(FL_OBJECT *, long)
{
// we set toggleall locally here, since it should be true for
// all other uses of ToggleAndShow() (JMarc)
}
-void CharacterCloseCB(FL_OBJECT *, long)
+extern "C" void CharacterCloseCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_character->form_character);
}
-void CharacterOKCB(FL_OBJECT *ob, long data)
+extern "C" void CharacterOKCB(FL_OBJECT *ob, long data)
{
CharacterApplyCB(ob,data);
CharacterCloseCB(ob,data);
}
-void ChoiceClassCB(FL_OBJECT *ob, long)
+extern "C" void ChoiceClassCB(FL_OBJECT *ob, long)
{
ProhibitInput();
if (lyxstyle.Load(fl_get_choice(ob)-1)) {
}
-void DocumentDefskipCB(FL_OBJECT *obj, long)
+extern "C" void DocumentDefskipCB(FL_OBJECT *obj, long)
{
// "Synchronize" the choice and the input field, so that it
// is impossible to commit senseless data.
}
-void DocumentSpacingCB(FL_OBJECT *obj, long)
+extern "C" void DocumentSpacingCB(FL_OBJECT *obj, long)
{
// "Synchronize" the choice and the input field, so that it
// is impossible to commit senseless data.
}
-void DocumentApplyCB(FL_OBJECT *, long)
+extern "C" void DocumentApplyCB(FL_OBJECT *, long)
{
bool redo = false;
BufferParams *params = &(current_view->currentBuffer()->params);
if (ret==1)
s= _("One paragraph couldn't be converted");
else {
- s += ret;
+ s += tostr(ret);
s += _(" paragraphs couldn't be converted");
}
WriteAlert(_("Conversion Errors!"),s,
}
-void DocumentCancelCB(FL_OBJECT *, long)
+extern "C" void DocumentCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_document->form_document);
}
-void DocumentOKCB(FL_OBJECT *ob, long data)
+extern "C" void DocumentOKCB(FL_OBJECT *ob, long data)
{
DocumentCancelCB(ob,data);
DocumentApplyCB(ob,data);
}
-void DocumentBulletsCB(FL_OBJECT *, long)
+extern "C" void DocumentBulletsCB(FL_OBJECT *, long)
{
bulletForm();
// bullet callbacks etc. in bullet_panel.C -- ARRae
/* callbacks for form form_quotes */
-void QuotesApplyCB(FL_OBJECT *, long)
+extern "C" void QuotesApplyCB(FL_OBJECT *, long)
{
if (!current_view->available())
return;
}
-void QuotesCancelCB(FL_OBJECT *, long)
+extern "C" void QuotesCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_quotes->form_quotes);
}
-void QuotesOKCB(FL_OBJECT *ob, long data)
+extern "C" void QuotesOKCB(FL_OBJECT *ob, long data)
{
QuotesApplyCB(ob, data);
QuotesCancelCB(ob, data);
/* callbacks for form form_preamble */
-void PreambleCancelCB(FL_OBJECT *, long)
+extern "C" void PreambleCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_preamble->form_preamble);
}
-void PreambleApplyCB(FL_OBJECT *, long)
+extern "C" void PreambleApplyCB(FL_OBJECT *, long)
{
if (!current_view->available())
return;
}
-void PreambleOKCB(FL_OBJECT *ob, long data)
+extern "C" void PreambleOKCB(FL_OBJECT *ob, long data)
{
PreambleApplyCB(ob, data);
PreambleCancelCB(ob, data);
/* callbacks for form form_table */
-void TableApplyCB(FL_OBJECT *, long)
+extern "C" void TableApplyCB(FL_OBJECT *, long)
{
int xsize,ysize;
if (!current_view->getScreen())
}
-void TableCancelCB(FL_OBJECT *, long)
+extern "C" void TableCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_table->form_table);
}
-void TableOKCB(FL_OBJECT *ob, long data)
+extern "C" void TableOKCB(FL_OBJECT *ob, long data)
{
TableApplyCB(ob,data);
TableCancelCB(ob,data);
/* callbacks for form form_print */
-void PrintCancelCB(FL_OBJECT *, long)
+extern "C" void PrintCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_print->form_print);
}
return strspn(cstr,cset) == strlen(cstr) ;
}
-void PrintApplyCB(FL_OBJECT *, long)
+extern "C" void PrintApplyCB(FL_OBJECT *, long)
{
if (!current_view->available())
return;
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
path = buffer->tmppath;
}
- PathPush(path);
+ Path p(path);
bool result;
if (!lyxrc->print_spool_command.empty() &&
}
} else
result = RunScript(buffer, false, command);
- PathPop();
if (!result)
WriteAlert(_("Error:"),
}
-void PrintOKCB(FL_OBJECT *ob, long data)
+extern "C" void PrintOKCB(FL_OBJECT *ob, long data)
{
PrintCancelCB(ob, data);
PrintApplyCB(ob,data);
/* callbacks for form form_figure */
-void FigureApplyCB(FL_OBJECT *, long)
+extern "C" void FigureApplyCB(FL_OBJECT *, long)
{
if (!current_view->available())
return;
}
-void FigureCancelCB(FL_OBJECT *, long)
+extern "C" void FigureCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_figure->form_figure);
}
-void FigureOKCB(FL_OBJECT *ob, long data)
+extern "C" void FigureOKCB(FL_OBJECT *ob, long data)
{
FigureApplyCB(ob,data);
FigureCancelCB(ob,data);
}
-void ScreenApplyCB(FL_OBJECT *, long)
+extern "C" void ScreenApplyCB(FL_OBJECT *, long)
{
lyxrc->roman_font_name = fl_get_input(fd_form_screen->input_roman);
lyxrc->sans_font_name = fl_get_input(fd_form_screen->input_sans);
}
-void ScreenCancelCB(FL_OBJECT *, long)
+extern "C" void ScreenCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_screen->form_screen);
}
-void ScreenOKCB(FL_OBJECT *ob, long data)
+extern "C" void ScreenOKCB(FL_OBJECT *ob, long data)
{
ScreenCancelCB(ob,data);
ScreenApplyCB(ob,data);
fl_raise_form(fd_latex_options->LaTeXOptions);
} else {
fl_show_form(fd_latex_options->LaTeXOptions,
- FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
+ FL_PLACE_MOUSE, FL_FULLBORDER,
_("LaTeX Options"));
}
}
minibuffer->Set(_("Running configure..."));
// Run configure in user lyx directory
- PathPush(user_lyxdir);
+ Path p(user_lyxdir);
Systemcalls one(Systemcalls::System,
AddName(system_lyxdir,"configure"));
- PathPop();
+ p.pop();
minibuffer->Set(_("Reloading configuration..."));
lyxrc->Read(LibFileSearch(string(), "lyxrc.defaults"));
WriteAlert(_("The system has been reconfigured."),
static TocList* toclist = 0;
-void TocSelectCB(FL_OBJECT *ob, long)
+extern "C" void TocSelectCB(FL_OBJECT *ob, long)
{
if (!current_view->available())
return;
}
-void TocCancelCB(FL_OBJECT *, long)
+extern "C" void TocCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_toc->form_toc);
}
-void TocUpdateCB(FL_OBJECT *, long)
+extern "C" void TocUpdateCB(FL_OBJECT *, long)
{
static LyXParagraph* stapar = 0;
TocList *tmptoclist = 0;
/* callbacks for form form_ref */
-void RefSelectCB(FL_OBJECT *, long data)
+extern "C" void RefSelectCB(FL_OBJECT *, long data)
{
if (!current_view->available())
return;
}
-void RefUpdateCB(FL_OBJECT *, long)
+extern "C" void RefUpdateCB(FL_OBJECT *, long)
{
if (!current_view->available()) {
fl_clear_browser(fd_form_ref->browser_ref);
}
-void RefHideCB(FL_OBJECT *, long)
+extern "C" void RefHideCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_ref->form_ref);
}
void addNewlineAndDepth(string &file, int const depth)
{
file += '\n';
- for (int j=0;j< depth;j++)
- file += ' ';
+ file.append(' ', depth);
}