From 13ae124f460830626c6ea39dd7b21e099959d110 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 3 Jul 2001 16:13:01 +0000 Subject: [PATCH] remove more forms.h cruft git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2177 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 14 +++++++++++++- src/ColorHandler.C | 15 ++++++++------- src/FontInfo.C | 6 +++--- src/FontLoader.C | 7 ++++--- src/Painter.C | 4 ++-- src/frontends/ChangeLog | 7 +++++++ src/frontends/GUIRunTime.h | 15 +++++++++++++++ src/frontends/xforms/ChangeLog | 10 ++++++++++ src/frontends/xforms/GUIRunTime.C | 24 ++++++++++++++++++++++++ src/graphics/ChangeLog | 5 +++++ src/graphics/ImageLoaderXPM.C | 6 +++--- src/lyx_cb.C | 5 ++--- 12 files changed, 96 insertions(+), 22 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1330897434..42766b5512 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2001-07-03 Jean-Marc Lasgouttes + + * ColorHandler.C (LyXColorHandler): use GUIRunTime instead of + calling directly xforms functions. + + * Painter.C (Painter): + * lyx_cb.C (MenuWrite): + * FontInfo.C (query): use GUIRunTime::x11Display() instead of + fl_display. + + * lyx_gui.C: remove bogus guiruntime extern declaration. + 2001-07-03 Lars Gullik Bjønnes * text2.C (redoHeightOfParagraph): comment out stuff we don't need @@ -20,7 +32,7 @@ * XFormsView.[Ch]: new files * LyXView.[Ch]: make LyXView a base class for the gui handling for - the main window. Move the gui dependand stuff to XFormsView + the main window. Move the gui dependent stuff to XFormsView 2001-07-03 Jean-Marc Lasgouttes diff --git a/src/ColorHandler.C b/src/ColorHandler.C index e2750572e8..2272dd12ae 100644 --- a/src/ColorHandler.C +++ b/src/ColorHandler.C @@ -15,22 +15,23 @@ #include -#include FORMS_H_LOCATION -#include "debug.h" - +#include "frontends/GUIRunTime.h" #include "ColorHandler.h" #include "LColor.h" #include "gettext.h" +#include "debug.h" using std::endl; LyXColorHandler::LyXColorHandler() { - display = fl_get_display(); - drawable = XCreatePixmap(display, fl_root, 10, 10, - fl_get_visual_depth()); + display = GUIRunTime::x11Display(); + drawable = XCreatePixmap(display, + RootWindow(display, GUIRunTime::x11Screen()), + 10, 10, + GUIRunTime::x11VisualDepth()); - colormap = fl_state[fl_get_vclass()].colormap; + colormap = GUIRunTime::x11Colormap(); // Clear the GC cache for (int i = 0; i <= LColor::ignore; ++i) { colorGCcache[i] = 0; diff --git a/src/FontInfo.C b/src/FontInfo.C index d87c199475..43aa03c577 100644 --- a/src/FontInfo.C +++ b/src/FontInfo.C @@ -11,8 +11,6 @@ #include #include // fabs() -#include FORMS_H_LOCATION - #ifdef __GNUG__ #pragma implementation "FontInfo.h" #endif @@ -21,6 +19,7 @@ #include "debug.h" #include "lyxrc.h" // lyxrc.use_scalable_fonts #include "support/lstrings.h" +#include "frontends/GUIRunTime.h" using std::endl; @@ -119,7 +118,8 @@ void FontInfo::query() char ** list = 0; if (lyxrc.use_gui) - list = XListFonts(fl_get_display(), pattern.c_str(), 100, &matches); + list = XListFonts(GUIRunTime::x11Display(), pattern.c_str(), + 100, &matches); if (list == 0) { // No fonts matched diff --git a/src/FontLoader.C b/src/FontLoader.C index 2d456a6b22..f137d806f2 100644 --- a/src/FontLoader.C +++ b/src/FontLoader.C @@ -23,6 +23,7 @@ #include "lyxrc.h" // lyxrc.font_* #include "BufferView.h" #include "LyXView.h" +#include "frontends/GUIRunTime.h" using std::endl; @@ -84,7 +85,7 @@ void FontLoader::unload() } for (int i4 = 0; i4 < 10; ++i4) { if (fontstruct[i1][i2][i3][i4]) { - XFreeFont(fl_get_display(), fontstruct[i1][i2][i3][i4]); + XFreeFont(GUIRunTime::x11Display(), fontstruct[i1][i2][i3][i4]); fontstruct[i1][i2][i3][i4] = 0; } } @@ -252,14 +253,14 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, current_view->owner()->messagePush(_("Loading font into X-Server...")); - fs = XLoadQueryFont(fl_get_display(), font.c_str()); + fs = XLoadQueryFont(GUIRunTime::x11Display(), font.c_str()); if (fs == 0) { if (font == "fixed") { lyxerr << "We're doomed. Can't get 'fixed' font." << endl; } else { lyxerr << "Could not get font. Using 'fixed'." << endl; - fs = XLoadQueryFont(fl_get_display(), "fixed"); + fs = XLoadQueryFont(GUIRunTime::x11Display(), "fixed"); } } else if (lyxerr.debugging(Debug::FONT)) { // Tell user the font matching diff --git a/src/Painter.C b/src/Painter.C index 7b4f1160fa..8c731244c3 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -19,11 +19,11 @@ #include -#include FORMS_H_LOCATION #include "Painter.h" #include "LString.h" #include "debug.h" #include "lyxfont.h" +#include "frontends/GUIRunTime.h" #include "support/LAssert.h" #include "support/lstrings.h" #include "WorkArea.h" @@ -41,7 +41,7 @@ using std::max; Painter::Painter(WorkArea & wa) : PainterBase(wa) { - display = fl_get_display(); + display = GUIRunTime::x11Display(); } diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index b0e7172e43..9f3ec9e491 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,10 @@ +2001-07-03 Jean-Marc Lasgouttes + + * GUIRunTime.h: (x11Display): + (x11Screen): + (x11Colormap): + (x11VisualDepth): new methods + 2001-07-03 Lars Gullik Bjønnes * GUIRunTime.h: add createMainView diff --git a/src/frontends/GUIRunTime.h b/src/frontends/GUIRunTime.h index 4f489728ee..156e74c125 100644 --- a/src/frontends/GUIRunTime.h +++ b/src/frontends/GUIRunTime.h @@ -15,6 +15,7 @@ #pragma interface #endif +#include class LyXView; /** The LyX GUI independent guiruntime class @@ -38,5 +39,19 @@ public: /// static LyXView * createMainView(int w, int h); + +/* the following entries are X11 specific and should eventually go away */ + /// The display on which LyX is running + static + Display * x11Display(); + /// The screen on which LyX is running + static + int x11Screen(); + /// The current colormap + static + Colormap x11Colormap(); + /// The current visual depth + static + int x11VisualDepth(); }; #endif diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index f63debfc0d..8fe51dca03 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,12 @@ +<<<<<<< ChangeLog +2001-07-03 Jean-Marc Lasgouttes + + * GUIRunTime.C (x11Display): + (x11Screen): + (x11Colormap): + (x11VisualDepth): new methods + +======= 2001-07-03 Lars Gullik Bjønnes * FormDocument.C (class_apply): call CutAndPaste::'s staitc method @@ -8,6 +17,7 @@ * GUIRunTime.C (createMainView): implement +>>>>>>> 1.104 2001-06-22 John Levon * FormCharacter.C: diff --git a/src/frontends/xforms/GUIRunTime.C b/src/frontends/xforms/GUIRunTime.C index 13dd471b58..3c24842fdd 100644 --- a/src/frontends/xforms/GUIRunTime.C +++ b/src/frontends/xforms/GUIRunTime.C @@ -117,3 +117,27 @@ LyXView * GUIRunTime::createMainView(int w, int h) { return new XFormsView(w, h); } + + +Display * GUIRunTime::x11Display() +{ + return fl_get_display(); +} + + +int GUIRunTime::x11Screen() +{ + return fl_screen; +} + + +Colormap GUIRunTime::x11Colormap() +{ + return fl_state[fl_get_vclass()].colormap; +} + + +int GUIRunTime::x11VisualDepth() +{ + return fl_get_visual_depth(); +} diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index fca4e0c723..96489a9ddd 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,8 @@ +2001-07-03 Jean-Marc Lasgouttes + + * ImageLoaderXPM.C (runImageLoader): get display information from + GUIRunTime. + 2001-06-14 Angus Leeming * GraphicsCache.C: diff --git a/src/graphics/ImageLoaderXPM.C b/src/graphics/ImageLoaderXPM.C index e683fdf54d..b92a0bb011 100644 --- a/src/graphics/ImageLoaderXPM.C +++ b/src/graphics/ImageLoaderXPM.C @@ -14,9 +14,9 @@ #include #include "ImageLoaderXPM.h" #include "frontends/support/LyXImage.h" +#include "frontends/GUIRunTime.h" #include "support/filetools.h" -#include FORMS_H_LOCATION #include XPM_H_LOCATION #include #include @@ -58,13 +58,13 @@ ImageLoaderXPM::loadableFormats() const ImageLoader::Result ImageLoaderXPM::runImageLoader(string const & filename) { - Display * display = fl_get_display(); + Display * display = GUIRunTime::x11Display(); //(BE 2000-08-05) #ifdef WITH_WARNINGS #warning This might be a dirty thing, but I dont know any other solution. #endif - Screen * screen = ScreenOfDisplay(display, fl_screen); + Screen * screen = ScreenOfDisplay(display, GUIRunTime::x11Screen()); Pixmap pixmap; Pixmap mask; diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 01f8b86075..c8b5566d2a 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -15,8 +15,6 @@ #include #include -#include FORMS_H_LOCATION - #include "lyx_cb.h" #include "lyx_gui_misc.h" #include "lyx_main.h" @@ -27,6 +25,7 @@ #include "lyxrc.h" #include "lyxtext.h" #include "frontends/FileDialog.h" +#include "frontends/GUIRunTime.h" #include "insets/insetlabel.h" #include "support/FileInfo.h" #include "support/filetools.h" @@ -134,7 +133,7 @@ void ShowMessage(Buffer const * buf, bool MenuWrite(BufferView * bv, Buffer * buffer) { // FIXME: needed ? - XFlush(fl_get_display()); + XFlush(GUIRunTime::x11Display()); if (!buffer->save()) { string const fname = buffer->fileName(); -- 2.39.2