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
This commit is contained in:
Peter Kümmel 2006-11-27 23:35:43 +00:00
parent 0cf508e2d3
commit c7a3620eeb
7 changed files with 40 additions and 17 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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<string>(geometry.width()));
session.sessionInfo().save("WindowHeight", convert<string>(geometry.height()));
session.sessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no"));
session.sessionInfo().save("IconSizeXY", convert<string>(iconSize().width()));
if (lyxrc.geometry_xysaved) {
session.sessionInfo().save("WindowPosX", convert<string>(geometry.x() + d.posx_offset));
session.sessionInfo().save("WindowPosY", convert<string>(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) {

View File

@ -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);

View File

@ -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<unsigned int>(val);
if (session().sessionInfo().load("WindowIsMaximized") == "yes")
maximize = true;
val = session().sessionInfo().load("IconSizeXY");
if (!val.empty())
iconSizeXY = convert<unsigned int>(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;
}