]> git.lyx.org Git - lyx.git/blobdiff - src/XFormsView.C
parch from Herbert
[lyx.git] / src / XFormsView.C
index 059e174a43e0f6b501d6d129b9cefac135442a4f..bb73db762bd46c46dd94ee6baa7d8ae81ab7c8d2 100644 (file)
@@ -1,9 +1,8 @@
-
 /* This file is part of
- * ====================================================== 
- * 
+ * ======================================================
+ *
  *           LyX, The Document Processor
- *        
+ *
  *           Copyright 1995 Matthias Ettrich
  *           Copyright 1995-2001 The LyX Team.
  *
@@ -15,9 +14,6 @@
 #pragma implementation
 #endif
 
-//#include <sys/time.h>
-//#include <unistd.h>
-
 #include "XFormsView.h"
 #if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
 #include "lyxlookup.h"
@@ -29,6 +25,7 @@
 #include "support/filetools.h"        // OnlyFilename()
 #include "frontends/Toolbar.h"
 #include "frontends/Menubar.h"
+#include "frontends/Timeout.h"
 #include "MenuBackend.h"
 #include "ToolbarDefaults.h"
 #include "lyxfunc.h"
@@ -42,7 +39,15 @@ extern void QuitLyX();
 // This is very temporary
 BufferView * current_view;
 
-extern "C" int C_XFormsView_atCloseMainFormCB(FL_FORM *, void *);
+extern "C" {
+
+static
+int C_XFormsView_atCloseMainFormCB(FL_FORM * form, void * p)
+{
+       return XFormsView::atCloseMainFormCB(form, p);
+}
+
+}
 
 
 XFormsView::XFormsView(int width, int height)
@@ -53,10 +58,10 @@ XFormsView::XFormsView(int width, int height)
 
        // Connect the minibuffer signals
        minibuffer->stringReady.connect(SigC::slot(getLyXFunc(),
-                                                  &LyXFunc::miniDispatch));
+                                               &LyXFunc::miniDispatch));
        minibuffer->timeout.connect(SigC::slot(getLyXFunc(),
                                               &LyXFunc::initMiniBuffer));
-       
+
        // Make sure the buttons are disabled if needed.
        updateToolbar();
 }
@@ -87,14 +92,6 @@ int XFormsView::atCloseMainFormCB(FL_FORM *, void *)
 }
 
 
-// Wrapper for the above
-extern "C"
-int C_XFormsView_atCloseMainFormCB(FL_FORM * form, void * p)
-{
-       return XFormsView::atCloseMainFormCB(form, p);
-}
-
-
 void XFormsView::setPosition(int x, int y)
 {
        fl_set_form_position(form_, x, y);
@@ -103,6 +100,7 @@ void XFormsView::setPosition(int x, int y)
 
 void XFormsView::show(int place, int border, string const & title)
 {
+       fl_set_form_minsize(form_, form_->w, form_->h);
        fl_show_form(form_, place, border, title.c_str());
        getLyXFunc()->initMiniBuffer();
 #if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
@@ -114,10 +112,10 @@ void XFormsView::show(int place, int border, string const & title)
 void XFormsView::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. 
+        * Hmmmm. Lgb.
         * We will probably not have lyxrc before the main form is
-        * initialized, because error messages from lyxrc parsing 
-        * are presented (and rightly so) in GUI popups. Asger. 
+        * initialized, because error messages from lyxrc parsing
+        * are presented (and rightly so) in GUI popups. Asger.
         */
 {
        // the main form
@@ -129,7 +127,7 @@ void XFormsView::create_form_form_main(int width, int height)
        // Parameters for the appearance of the main form
        int const air = 2;
        int const bw = abs(fl_get_border_width());
-       
+
        //
        // THE MENUBAR
        //
@@ -159,20 +157,20 @@ void XFormsView::create_form_form_main(int width, int height)
        // MINIBUFFER
        //
 
-       minibuffer = new MiniBuffer(this, air, height - (25 + air), 
+       minibuffer = new MiniBuffer(this, air, height - (25 + air),
                                    width - (2 * air), 25);
 
        //
        // TIMERS
        //
 
-       autosave_timeout.timeout.connect(SigC::slot(this, &XFormsView::AutoSave));
-       
+       autosave_timeout->timeout.connect(SigC::slot(this, &XFormsView::AutoSave));
+
        //
        // Misc
        //
 
-        //  assign an icon to main form
+       //  assign an icon to main form
        string iconname = LibFileSearch("images", "lyx", "xpm");
        if (!iconname.empty()) {
                unsigned int w, h;
@@ -190,8 +188,10 @@ void XFormsView::create_form_form_main(int width, int height)
 
        // set min size
        fl_set_form_minsize(form_, 50, 50);
-       
+
        fl_end_form();
+
+       minibuffer->dd_init();
 }
 
 
@@ -201,20 +201,21 @@ void XFormsView::init()
        invalidateLayoutChoice();
        updateLayoutChoice();
        updateMenubar();
-       
+
        // Start autosave timer
        if (lyxrc.autosave) {
-               autosave_timeout.setTimeout(lyxrc.autosave * 1000);
-               autosave_timeout.start();
+               autosave_timeout->setTimeout(lyxrc.autosave * 1000);
+               autosave_timeout->start();
        }
 
        intl->InitKeyMapper(lyxrc.use_kbmap);
 }
 
 
-void XFormsView::setWindowTitle(string const & title)
+void XFormsView::setWindowTitle(string const & title, string const & icon_title)
 {
        fl_set_form_title(form_, title.c_str());
+       fl_winicontitle(form_->window, icon_title.c_str());
 }
 
 
@@ -231,14 +232,14 @@ void XFormsView::prohibitInput() const
 
        static Cursor cursor;
        static bool cursor_undefined = true;
-   
-       if (cursor_undefined){
+
+       if (cursor_undefined) {
                cursor = XCreateFontCursor(fl_get_display(), XC_watch);
                XFlush(fl_get_display());
                cursor_undefined = false;
        }
-   
-       /* set the cursor to the watch for all forms and the canvas */ 
+
+       /* set the cursor to the watch for all forms and the canvas */
        XDefineCursor(fl_get_display(), getForm()->window, cursor);
 
        XFlush(fl_get_display());
@@ -249,7 +250,7 @@ void XFormsView::prohibitInput() const
 void XFormsView::allowInput() const
 {
        /* reset the cursor from the watch for all forms and the canvas */
-   
+
        XUndefineCursor(fl_get_display(), getForm()->window);
 
        XFlush(fl_get_display());