]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
removed a warning from screen and added CFLAGS in lyx.spec.in.
[lyx.git] / src / lyx_cb.C
index 6bea5130bcb2cbc422b6f466e64f83be3c82a1d6..5a6679495ed32a04fb02cca4949c588f70e70176 100644 (file)
@@ -465,7 +465,7 @@ int MenuRunLaTeX(Buffer *buffer)
                        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.");
                }
@@ -497,7 +497,7 @@ int MenuBuildProg(Buffer *buffer)
                        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.");
                }
@@ -526,7 +526,7 @@ int MenuRunChktex(Buffer *buffer)
                        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.");
                }
@@ -966,7 +966,7 @@ void MenuPrint(Buffer *buffer)
        } 
        else {
                fl_show_form(fd_form_print->form_print,
-                            FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
+                            FL_PLACE_MOUSE, FL_FULLBORDER,
                             _("Print"));
        }
 }
@@ -1147,6 +1147,8 @@ void InsertAsciiFile(string const & f, bool asParagraph)
 
 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);
@@ -1154,6 +1156,11 @@ void MenuShowTableOfContents()
                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);
        }
 }
 
@@ -1176,6 +1183,8 @@ void MenuInsertLabel(const char *arg)
 
 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);
@@ -1183,6 +1192,11 @@ void MenuInsertRef()
                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);
        }
 }
 
@@ -1206,7 +1220,7 @@ void MenuPasteSelection(char at)
 }
 
 
-void FootCB(FL_OBJECT*, long)
+extern "C" void FootCB(FL_OBJECT*, long)
 {
        if (!current_view->available()) 
                return;
@@ -1457,12 +1471,19 @@ void AllFloats(char flag, char figmar)
 
 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);
        }
 }
 
@@ -1664,7 +1685,7 @@ void MenuLayoutParagraph()
                        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_MOUSEFL_FULLBORDER,
                                     _("Paragraph Environment"));
                }
        }
@@ -1915,8 +1936,7 @@ void MenuLayoutDocument()
                        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"));
                }
        }
@@ -1954,8 +1974,7 @@ void MenuLayoutQuotes()
                        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"));
                }
        }
@@ -1994,6 +2013,8 @@ bool UpdateLayoutPreamble()
 
 void MenuLayoutPreamble()
 {
+       static int ow = -1, oh;
+
        if (UpdateLayoutPreamble()) {
                if (fd_form_preamble->form_preamble->visible) {
                        fl_raise_form(fd_form_preamble->form_preamble);
@@ -2002,6 +2023,12 @@ void MenuLayoutPreamble()
                                     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);
                }
        }
 }
@@ -2305,7 +2332,7 @@ void ToggleAndShow(LyXFont const & font)
 }
 
 
-void MarginCB(FL_OBJECT *, long)
+extern "C" void MarginCB(FL_OBJECT *, long)
 {
        if (current_view->available()) {
                minibuffer->Set(_("Inserting margin note..."));
@@ -2317,7 +2344,7 @@ void MarginCB(FL_OBJECT *, long)
 }
 
 
-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);
@@ -2329,13 +2356,13 @@ void FigureCB(FL_OBJECT *, long)
 }
 
 
-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"));
        }
 }
@@ -2411,7 +2438,7 @@ void PasteCB()
 }
 
 
-void MeltCB(FL_OBJECT *, long)
+extern "C" void MeltCB(FL_OBJECT *, long)
 {
        if (!current_view->available()) return;
        
@@ -2428,7 +2455,7 @@ void MeltCB(FL_OBJECT *, long)
 // 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;
 
@@ -2551,7 +2578,7 @@ void FreeCB()
 
 
 /* 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) {
@@ -2566,7 +2593,7 @@ void TimerCB(FL_OBJECT *, long)
 
 /* 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.
@@ -2617,7 +2644,7 @@ void ParagraphVSpaceCB(FL_OBJECT* obj, long )
 }
 
 
-void ParagraphApplyCB(FL_OBJECT *, long)
+extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->available())
                return;
@@ -2693,13 +2720,13 @@ void ParagraphApplyCB(FL_OBJECT *, long)
 }
 
 
-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);
@@ -2708,7 +2735,7 @@ void ParagraphOKCB(FL_OBJECT *ob, long 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)
@@ -2718,13 +2745,13 @@ void CharacterApplyCB(FL_OBJECT *, long)
 }
 
 
-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);
@@ -2755,7 +2782,7 @@ void UpdateDocumentButtons(BufferParams const &params)
        
 }
 
-void ChoiceClassCB(FL_OBJECT *ob, long)
+extern "C" void ChoiceClassCB(FL_OBJECT *ob, long)
 {
        ProhibitInput();
        if (lyxstyle.Load(fl_get_choice(ob)-1)) {
@@ -2780,7 +2807,7 @@ void ChoiceClassCB(FL_OBJECT *ob, long)
 }
 
 
-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.
@@ -2809,7 +2836,7 @@ void DocumentDefskipCB(FL_OBJECT *obj, long)
 }
 
 
-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.
@@ -2831,7 +2858,7 @@ void DocumentSpacingCB(FL_OBJECT *obj, long)
 }
 
 
-void DocumentApplyCB(FL_OBJECT *, long)
+extern "C" void DocumentApplyCB(FL_OBJECT *, long)
 {
        bool redo = false;
        BufferParams *params = &(current_view->currentBuffer()->params);
@@ -2886,7 +2913,7 @@ void DocumentApplyCB(FL_OBJECT *, long)
                                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,
@@ -2985,20 +3012,20 @@ void DocumentApplyCB(FL_OBJECT *, long)
 }
 
 
-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
@@ -3056,7 +3083,7 @@ void InsertCorrectQuote()
 
 /* callbacks for form form_quotes */
 
-void QuotesApplyCB(FL_OBJECT *, long)
+extern "C" void QuotesApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->available())
                return;
@@ -3095,13 +3122,13 @@ void QuotesApplyCB(FL_OBJECT *, long)
 }
 
 
-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);
@@ -3111,13 +3138,13 @@ void QuotesOKCB(FL_OBJECT *ob, long 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;
@@ -3129,7 +3156,7 @@ void PreambleApplyCB(FL_OBJECT *, long)
 }
 
    
-void PreambleOKCB(FL_OBJECT *ob, long data)
+extern "C" void PreambleOKCB(FL_OBJECT *ob, long data)
 {
        PreambleApplyCB(ob, data);
        PreambleCancelCB(ob, data);
@@ -3138,7 +3165,7 @@ void PreambleOKCB(FL_OBJECT *ob, long 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())
@@ -3216,13 +3243,13 @@ void TableApplyCB(FL_OBJECT *, long)
 }
 
 
-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);
@@ -3231,7 +3258,7 @@ void TableOKCB(FL_OBJECT *ob, long 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);
 }
@@ -3243,7 +3270,7 @@ static bool stringOnlyContains (string const & LStr, const char * cset)
        return strspn(cstr,cset) == strlen(cstr) ;
 }
 
-void PrintApplyCB(FL_OBJECT *, long)
+extern "C" void PrintApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->available())
                return;
@@ -3406,7 +3433,7 @@ void PrintApplyCB(FL_OBJECT *, long)
 }
 
 
-void PrintOKCB(FL_OBJECT *ob, long data)
+extern "C" void PrintOKCB(FL_OBJECT *ob, long data)
 {
        PrintCancelCB(ob, data);  
        PrintApplyCB(ob,data);
@@ -3415,7 +3442,7 @@ void PrintOKCB(FL_OBJECT *ob, long data)
 
 /* callbacks for form form_figure */
 
-void FigureApplyCB(FL_OBJECT *, long)
+extern "C" void FigureApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->available())
                return;
@@ -3486,19 +3513,19 @@ void FigureApplyCB(FL_OBJECT *, long)
 }
 
    
-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);
@@ -3514,13 +3541,13 @@ void ScreenApplyCB(FL_OBJECT *, long)
 }
 
 
-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);
@@ -3539,7 +3566,7 @@ void LaTeXOptions()
                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"));
        }
 }
@@ -3643,7 +3670,7 @@ struct TocList {
 static TocList* toclist = 0;
 
 
-void TocSelectCB(FL_OBJECT *ob, long)
+extern "C" void TocSelectCB(FL_OBJECT *ob, long)
 {
        if (!current_view->available())
                return;
@@ -3687,13 +3714,13 @@ void TocSelectCB(FL_OBJECT *ob, long)
 }
 
 
-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;
@@ -3799,7 +3826,7 @@ void TocUpdateCB(FL_OBJECT *, long)
 
 
 /* callbacks for form form_ref */
-void RefSelectCB(FL_OBJECT *, long data)
+extern "C" void RefSelectCB(FL_OBJECT *, long data)
 {
        if (!current_view->available())
                return;
@@ -3834,7 +3861,7 @@ void RefSelectCB(FL_OBJECT *, long data)
 }
 
 
-void RefUpdateCB(FL_OBJECT *, long)
+extern "C" void RefUpdateCB(FL_OBJECT *, long)
 {
        if (!current_view->available()) {
                fl_clear_browser(fd_form_ref->browser_ref);
@@ -3903,7 +3930,7 @@ void RefUpdateCB(FL_OBJECT *, long)
 }
 
 
-void RefHideCB(FL_OBJECT *, long)
+extern "C" void RefHideCB(FL_OBJECT *, long)
 {
        fl_hide_form(fd_form_ref->form_ref);
 }
@@ -4055,8 +4082,7 @@ void UpdateInsetUpdateList()
 void addNewlineAndDepth(string &file, int const depth)
 {
        file += '\n';
-       for (int j=0;j< depth;j++)
-               file += ' ';
+       file.append(' ', depth);
 }