>>> I guess that keeping trace of the menuBar pointer (via a static variable 
>>> outside the ctor) and try to hide it could work.
>>>
>>> One has to try...
>> so to complete this menubar hiddening under mac and window decoration 
>> under ms win
>> should be done. do you think its part of lyx assignment or should it be 
>> let as third
>> party bussiness?
>
> I don't know for sure but I guess it should be done within LyX. For Mac,  
> the method I've outlined above should probably work. I see that Firefox is 
> able to hide all window decoration under Windows so I guess it is possible 
> to do it for LyX too.

hrrrrrrm. finally i was able get rid of both frames and window decorations.
however i cannot say what it will do under non X11 systems or under gnome/kde 
dm.
testers?
comments?

Bennett, try whether "ui-toggle fullscreen" hide the global menu by chance...

pavel
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index a07fd70..6640414 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -1103,24 +1103,7 @@ void LyXAction::init()
  */
                { LFUN_TOOLBAR_TOGGLE, "toolbar-toggle", NoBuffer, Buffer },
                { LFUN_MENU_OPEN, "menu-open", NoBuffer, Buffer },
-/*!
- * \var lyx::kb_action lyx::LFUN_MENUBAR_TOGGLE
- * \li Action: Toggles visibility of the main menu.
- * \li Notion: This can be used for the fullscreen mode.
- * \li Syntax: menubar-toggle
- * \li Origin: ps, 6 Feb 2008
- * \endvar
- */
-               { LFUN_MENUBAR_TOGGLE, "menubar-toggle", NoBuffer, Buffer },
-/*!
- * \var lyx::kb_action lyx::LFUN_STATUSBAR_TOGGLE
- * \li Action: Toggles visibility of the main menu.
- * \li Notion: This can be used for the fullscreen mode.
- * \li Syntax: statusbar-toggle
- * \li Origin: ps, 6 Feb 2008
- * \endvar
- */
-               { LFUN_STATUSBAR_TOGGLE, "statusbar-toggle", NoBuffer, Buffer },
+               { LFUN_UI_TOGGLE, "ui-toggle", NoBuffer, Buffer },
 
                { LFUN_WINDOW_NEW, "window-new", NoBuffer, Buffer },
                { LFUN_WINDOW_CLOSE, "window-close", NoBuffer, Buffer },
diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp
index 82b6c24..1cb8870 100644
--- a/src/LyXFunc.cpp
+++ b/src/LyXFunc.cpp
@@ -453,8 +453,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
 
        case LFUN_TOOLBAR_TOGGLE:
-       case LFUN_MENUBAR_TOGGLE:
-       case LFUN_STATUSBAR_TOGGLE:
+       case LFUN_UI_TOGGLE:
        case LFUN_INSET_APPLY:
        case LFUN_BUFFER_WRITE:
        case LFUN_BUFFER_WRITE_AS:
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 8004133..32b219e 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1800,13 +1800,48 @@ bool GuiView::dispatch(FuncRequest const & cmd)
                        break;
                }
 
-               case LFUN_MENUBAR_TOGGLE:
-                       menuBar()->setVisible(!menuBar()->isVisible());
-                       break;
+               case LFUN_UI_TOGGLE: {
+                       string const arg = cmd.getArg(0);
+                       if (arg == "statusbar")
+                               
statusBar()->setVisible(!statusBar()->isVisible());
+                       else if (arg == "menubar")
+                               menuBar()->setVisible(!menuBar()->isVisible());
+#if QT_VERSION >= 0x040300
+                       else if (arg == "frame") {
+                               int l,t,r,b;
+                               getContentsMargins(&l,&t,&r,&b);
+                               //are the frames in default state?
+                               if (l==0) {
+                                       
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
+                                       setContentsMargins(-2, -2, -2, -2);
+                               } else {
+                                       
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
+                                       setContentsMargins(0, 0, 0, 0);
+                               }
+                       }
+#endif
+                       else if (arg == "fullscreen") {
+                               if (isFullScreen()) {
+                                       showNormal();
+#if QT_VERSION >= 0x040300
+                                       setContentsMargins(0, 0, 0, 0);
+#endif
+                                       
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
+                                       menuBar()->show();
+                                       statusBar()->show();
+                               } else {
+                                       statusBar()->hide();
+                                       menuBar()->hide();
+                                       
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
+#if QT_VERSION >= 0x040300
+                                       setContentsMargins(-2, -2, -2, -2);
+#endif
+                                       showFullScreen();
+                               }
+                       }
 
-               case LFUN_STATUSBAR_TOGGLE:
-                       statusBar()->setVisible(!statusBar()->isVisible());
                        break;
+               }
 
                default:
                        return false;
diff --git a/src/lfuns.h b/src/lfuns.h
index cfde9bb..31331d1 100644
--- a/src/lfuns.h
+++ b/src/lfuns.h
@@ -413,9 +413,7 @@ enum kb_action {
        LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM,
        LFUN_IN_MATHMACROTEMPLATE,
        LFUN_SCROLL,
-       LFUN_MENUBAR_TOGGLE,
-       LFUN_STATUSBAR_TOGGLE,
-       // 320
+       LFUN_UI_TOGGLE,
        LFUN_LASTACTION                  // end of the table
 };
 

Reply via email to