From c7a3620eebe4aaf1a195fd918970b1431dffbb6e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Mon, 27 Nov 2006 23:35:43 +0000 Subject: [PATCH] fix wrong toolbar icon size, default value is in lyx_main.C. Size will be stored in the session file. * src/lyx_main.C : default value * src/frontends/Application.h : restore also icon size * src/frontends/LyXView.h : " * src/frontends/qt4/GuiView.h : " * src/frontends/qt4/GuiView.C : " * src/frontends/Application.C : " git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16085 a592a061-630c-0410-9148-cb99ea01b6c8 --- Status.15x | 12 +++++++----- src/frontends/Application.C | 5 +++-- src/frontends/Application.h | 2 +- src/frontends/LyXView.h | 3 ++- src/frontends/qt4/GuiView.C | 25 +++++++++++++++++++------ src/frontends/qt4/GuiView.h | 3 ++- src/lyx_main.C | 7 ++++++- 7 files changed, 40 insertions(+), 17 deletions(-) diff --git a/Status.15x b/Status.15x index 771a715d0f..cd4d1427a4 100644 --- a/Status.15x +++ b/Status.15x @@ -126,11 +126,6 @@ TOOLBARS & MINIBUFFER * When toolbars are hidden, they pop up again after clicking on the document area (Joost 4/11/06). -* Icons in the toolbars do not have the correct size, they are stretched a few - pixels compared to 1.4. This makes the images look jagged and the initial - window size has also become to small to show the whole toolbar - (Joost 4/11/06). See also the math panel buttons entry above. - * TODO toolbar popup menu, currently disabled (Peter 9/11/06) @@ -457,3 +452,10 @@ CREDITS: * new document; insert note; insert "hello" into note; place the cursor at the beginning of the note; activate change tracking; press backspace => seg fault FIXED (Michael 2006-11-25) + +* Icons in the toolbars do not have the correct size, they are stretched a few + pixels compared to 1.4. This makes the images look jagged and the initial + window size has also become to small to show the whole toolbar + (Joost 4/11/06). See also the math panel buttons entry above. + FIXED (Peter, 2006-11-28) + diff --git a/src/frontends/Application.C b/src/frontends/Application.C index 98d357427b..7d2dc98552 100644 --- a/src/frontends/Application.C +++ b/src/frontends/Application.C @@ -51,7 +51,8 @@ Application::Application(int &, char **) LyXView & Application::createView(unsigned int width, unsigned int height, int posx, int posy, - bool maximize) + bool maximize, + unsigned int iconSizeXY) { int view_id = gui().newView(); LyXView & view = gui().view(view_id); @@ -61,7 +62,7 @@ LyXView & Application::createView(unsigned int width, /*int workArea_id_ =*/ gui().newWorkArea(width, height, view_id); view.init(); - view.setGeometry(width, height, posx, posy, maximize); + view.setGeometry(width, height, posx, posy, maximize, iconSizeXY); setCurrentView(view); diff --git a/src/frontends/Application.h b/src/frontends/Application.h index 8f977ab737..76031a4a0c 100644 --- a/src/frontends/Application.h +++ b/src/frontends/Application.h @@ -172,7 +172,7 @@ public: /// Create the main window with given geometry settings. LyXView & createView(unsigned int width, unsigned int height, - int posx, int posy, bool maximize); + int posx, int posy, bool maximize, unsigned int iconSizeXY); /// LyXView const & currentView() const; diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index 6f36161c09..5a2bfadeaa 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -87,7 +87,8 @@ public: unsigned int width, unsigned int height, int posx, int posy, - bool maximize) = 0; + bool maximize, + unsigned int iconSizeXY) = 0; /// save the geometry state in the session manager. virtual void saveGeometry() = 0; diff --git a/src/frontends/qt4/GuiView.C b/src/frontends/qt4/GuiView.C index 6b563ab3d9..d98c527637 100644 --- a/src/frontends/qt4/GuiView.C +++ b/src/frontends/qt4/GuiView.C @@ -6,6 +6,7 @@ * \author Lars Gullik Bjønnes * \author John Levon * \author Abdelrazak Younes + * \author Peter Kümmel * * Full author contact details are available in file CREDITS. */ @@ -105,15 +106,20 @@ struct GuiView::GuiViewPrivate GuiViewPrivate() : wt(0), posx_offset(0), posy_offset(0) {} + + static int iconSizeXY_; }; +int GuiView::GuiViewPrivate::iconSizeXY_ = -1; + GuiView::GuiView(int id) : QMainWindow(), LyXView(id), commandbuffer_(0), d(*new GuiViewPrivate) { -// setToolButtonStyle(Qt::ToolButtonIconOnly); -// setIconSize(QSize(12,12)); + // static var needed by the "New Window", because setGeometry will not be called + if (GuiViewPrivate::iconSizeXY_ != -1) + setIconSize(QSize(GuiViewPrivate::iconSizeXY_, GuiViewPrivate::iconSizeXY_)); -// bufferview_.reset(new BufferView(this, width, height)); + //bufferview_.reset(new BufferView(this, width, height)); #ifndef Q_WS_MACX // assign an icon to main form. We do not do it under Qt/Mac, @@ -139,8 +145,7 @@ void GuiView::close() QMenu* GuiView::createPopupMenu() { // disable toolbar popup menu - // Qt docs: Ownership of the popup menu is transferred to the caller. - return new QMenu; + return 0; } void GuiView::init() @@ -187,6 +192,7 @@ void GuiView::saveGeometry() session.sessionInfo().save("WindowWidth", convert(geometry.width())); session.sessionInfo().save("WindowHeight", convert(geometry.height())); session.sessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no")); + session.sessionInfo().save("IconSizeXY", convert(iconSize().width())); if (lyxrc.geometry_xysaved) { session.sessionInfo().save("WindowPosX", convert(geometry.x() + d.posx_offset)); session.sessionInfo().save("WindowPosY", convert(geometry.y() + d.posy_offset)); @@ -197,8 +203,15 @@ void GuiView::saveGeometry() void GuiView::setGeometry(unsigned int width, unsigned int height, int posx, int posy, - bool maximize) + bool maximize, + unsigned int iconSizeXY) { + if (iconSizeXY > 8) + GuiViewPrivate::iconSizeXY_ = iconSizeXY; + else + GuiViewPrivate::iconSizeXY_ = 28; + setIconSize(QSize(GuiViewPrivate::iconSizeXY_, GuiViewPrivate::iconSizeXY_)); + // only true when the -geometry option was NOT used if (width != 0 && height != 0) { if (posx != -1 && posy != -1) { diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index c4fb5317d7..43d3e859ff 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -59,7 +59,8 @@ public: unsigned int width, unsigned int height, int posx, int posy, - bool maximize); + bool maximize, + unsigned int iconSizeXY); virtual void saveGeometry(); virtual void busy(bool); Toolbars::ToolbarPtr makeToolbar(ToolbarBackend::Toolbar const & tbb); diff --git a/src/lyx_main.C b/src/lyx_main.C index de468f542d..6833bc16c0 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -560,6 +560,8 @@ LyXView * LyX::newLyXView() // initial geometry unsigned int width = 690; unsigned int height = 510; + // default icon size, will be overwritten by stored session value + unsigned int iconSizeXY = 26; bool maximize = false; // first try lyxrc if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) { @@ -576,6 +578,9 @@ LyXView * LyX::newLyXView() height = convert(val); if (session().sessionInfo().load("WindowIsMaximized") == "yes") maximize = true; + val = session().sessionInfo().load("IconSizeXY"); + if (!val.empty()) + iconSizeXY = convert(val); } // if user wants to restore window position @@ -595,7 +600,7 @@ LyXView * LyX::newLyXView() height = 0; } // create the main window - LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximize); + LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximize, iconSizeXY); return view; } -- 2.39.2