mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
amortise panel load times
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5277 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bb2b4dd0b9
commit
938f52dcc4
@ -1,3 +1,8 @@
|
|||||||
|
2002-09-12 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* QMathDialog.h:
|
||||||
|
* QMathDialog.C: load icon palettes on demand
|
||||||
|
|
||||||
2002-09-12 John Levon <levon@movementarian.org>
|
2002-09-12 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* QMathDialog.C: get the scrollbars right on first show
|
* QMathDialog.C: get the scrollbars right on first show
|
||||||
|
@ -32,7 +32,7 @@ using std::endl;
|
|||||||
class QScrollViewSingle : public QScrollView {
|
class QScrollViewSingle : public QScrollView {
|
||||||
public:
|
public:
|
||||||
QScrollViewSingle(QWidget * p)
|
QScrollViewSingle(QWidget * p)
|
||||||
: QScrollView(p) {
|
: QScrollView(p), w_(0) {
|
||||||
setResizePolicy(Manual);
|
setResizePolicy(Manual);
|
||||||
setHScrollBarMode(AlwaysOff);
|
setHScrollBarMode(AlwaysOff);
|
||||||
setVScrollBarMode(AlwaysOn);
|
setVScrollBarMode(AlwaysOn);
|
||||||
@ -70,6 +70,8 @@ namespace {
|
|||||||
latex_ams_misc
|
latex_ams_misc
|
||||||
};
|
};
|
||||||
int const nr_panels = sizeof(panels)/sizeof(panels[0]);
|
int const nr_panels = sizeof(panels)/sizeof(panels[0]);
|
||||||
|
|
||||||
|
bool panel_initialised[nr_panels];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,10 +86,26 @@ QMathDialog::QMathDialog(QMath * form)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nr_panels; ++i) {
|
for (int i = 0; i < nr_panels; ++i) {
|
||||||
addPanel(panels[i]);
|
QScrollViewSingle * view = new QScrollViewSingle(symbolsWS);
|
||||||
|
symbolsWS->addWidget(view, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// aboutToShow() only fires when != 0 in Qt 2 !
|
||||||
symbolsWS->raiseWidget(0);
|
symbolsWS->raiseWidget(0);
|
||||||
symbolsWS->resize(symbolsWS->sizeHint());
|
addPanel(0);
|
||||||
|
panel_initialised[0] = true;
|
||||||
|
|
||||||
|
connect(symbolsWS, SIGNAL(aboutToShow(int)), this, SLOT(showingPanel(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QMathDialog::showingPanel(int num)
|
||||||
|
{
|
||||||
|
if (panel_initialised[num])
|
||||||
|
return;
|
||||||
|
|
||||||
|
addPanel(num);
|
||||||
|
panel_initialised[num] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,15 +122,11 @@ IconPalette * QMathDialog::makePanel(QWidget * parent, char const ** entries)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QMathDialog::addPanel(char const ** entries)
|
void QMathDialog::addPanel(int num)
|
||||||
{
|
{
|
||||||
static int id = 0;
|
QScrollViewSingle * view = static_cast<QScrollViewSingle*>(symbolsWS->visibleWidget());
|
||||||
|
IconPalette * p = makePanel(view->viewport(), panels[num]);
|
||||||
QScrollViewSingle * view = new QScrollViewSingle(symbolsWS);
|
|
||||||
|
|
||||||
IconPalette * p = makePanel(view->viewport(), entries);
|
|
||||||
view->setChild(p);
|
view->setChild(p);
|
||||||
symbolsWS->addWidget(view, id++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +38,9 @@ public slots:
|
|||||||
virtual void superscriptClicked();
|
virtual void superscriptClicked();
|
||||||
void symbol_clicked(string str);
|
void symbol_clicked(string str);
|
||||||
|
|
||||||
|
/// about to show a symbol panel
|
||||||
|
void showingPanel(int);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//needed ? virtual void closeEvent(QCloseEvent * e);
|
//needed ? virtual void closeEvent(QCloseEvent * e);
|
||||||
|
|
||||||
@ -46,7 +49,7 @@ private:
|
|||||||
IconPalette * makePanel(QWidget * parent, char const ** entries);
|
IconPalette * makePanel(QWidget * parent, char const ** entries);
|
||||||
|
|
||||||
/// add a symbol panel
|
/// add a symbol panel
|
||||||
void addPanel(char const ** entries);
|
void addPanel(int num);
|
||||||
|
|
||||||
/// owning form
|
/// owning form
|
||||||
QMath * form_;
|
QMath * form_;
|
||||||
|
Loading…
Reference in New Issue
Block a user