Fix the WorkArea problems.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2834 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-10-02 16:00:54 +00:00
parent c5e13278e7
commit f360c39690
4 changed files with 39 additions and 79 deletions

View File

@ -208,7 +208,6 @@ void BufferView::Pimpl::buffer(Buffer * b)
// hidden. This should go here because some dialogs (eg ToC) // hidden. This should go here because some dialogs (eg ToC)
// require bv_->text. // require bv_->text.
owner_->getDialogs()->updateBufferDependent(true); owner_->getDialogs()->updateBufferDependent(true);
workarea_.show();
redraw(); redraw();
insetWakeup(); insetWakeup();
} else { } else {

View File

@ -1,3 +1,13 @@
2001-10-01 Angus Leeming <a.leeming@ic.ac.uk>
* BufferView_pimpl.C (buffer): remove call to WorkArea::show() and
revert to previous code.
WorkArea.[Ch]: (show, destroySplash): methods removed.
WorkArea.C: rework code so that it's an amalgam of the codes before and
after the splash screen was moved to WorkArea.
2001-10-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-10-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lyxrc.C (read): * lyxrc.C (read):

View File

@ -64,31 +64,6 @@ extern "C" {
return WorkArea::work_area_handler(ob, event, return WorkArea::work_area_handler(ob, event,
0, 0, key, xev); 0, 0, key, xev);
} }
// Resizing the display causes the version string to move relative to
// the splash pixmap because the parameters xforms uses to control
// resizing are not very sophisticated.
// I found it easier, therefore, to just remove the splash screen.
// (Angus, 25 September 2001)
static
int C_WorkAreaSplashPH(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord, int, void *)
{
static int counter = 0;
if (event != FL_DRAW || ++counter > 3) {
return 0;
}
lyx::Assert(ob && ob->u_vdata);
WorkArea * pre = static_cast<WorkArea *>(ob->u_vdata);
if (counter == 3) {
pre->destroySplash();
}
return 0;
}
} }
@ -140,9 +115,6 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
fl_add_pixmapbutton(FL_NORMAL_BUTTON, fl_add_pixmapbutton(FL_NORMAL_BUTTON,
splash_x, splash_y, splash_x, splash_y,
splash_w, splash_h, ""); splash_w, splash_h, "");
obj->u_vdata = this;
fl_set_object_prehandler(obj, C_WorkAreaSplashPH);
fl_set_pixmapbutton_file(obj, splash_file.c_str()); fl_set_pixmapbutton_file(obj, splash_file.c_str());
fl_set_pixmapbutton_focus_outline(obj, 3); fl_set_pixmapbutton_focus_outline(obj, 3);
fl_set_object_boxtype(obj, FL_NO_BOX); fl_set_object_boxtype(obj, FL_NO_BOX);
@ -159,9 +131,6 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
fl_set_object_lcol(obj, FL_FREE_COL3); fl_set_object_lcol(obj, FL_FREE_COL3);
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_lstyle(obj, FL_BOLD_STYLE);
fl_hide_object(splash_);
fl_hide_object(splash_text_);
} }
// //
@ -258,14 +227,37 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
width - 15 - 2 * bw, width - 15 - 2 * bw,
height - 2 * bw); height - 2 * bw);
destroySplash();
fl_unfreeze_all_forms(); fl_unfreeze_all_forms();
} }
namespace {
void destroy_object(FL_OBJECT * obj)
{
if (!obj)
return;
if (obj->visible) {
fl_hide_object(obj);
}
fl_delete_object(obj);
fl_free_object(obj);
}
} // namespace anon
void WorkArea::createPixmap(int width, int height) void WorkArea::createPixmap(int width, int height)
{ {
// Three calls to createPixmap are needed to draw the initial view
// of LyX. Any more and the splash is destroyed.
static int counter = 0;
if (++counter == 4) {
destroy_object(splash_);
splash_ = 0;
destroy_object(splash_text_);
splash_text_ = 0;
}
static int cur_width = -1; static int cur_width = -1;
static int cur_height = -1; static int cur_height = -1;
@ -292,49 +284,12 @@ void WorkArea::createPixmap(int width, int height)
} }
void WorkArea::show() const
{
if (!work_area->visible) {
fl_show_object(work_area);
}
destroySplash();
}
void WorkArea::greyOut() const void WorkArea::greyOut() const
{ {
if (work_area->visible) { if (!splash_) {
fl_hide_object(work_area); fl_winset(FL_ObjWin(work_area));
} fl_rectangle(1, work_area->x, work_area->y,
work_area->w, work_area->h, FL_GRAY63);
if (splash_ && !splash_->visible) {
fl_show_object(splash_);
fl_show_object(splash_text_);
}
}
void WorkArea::destroySplash() const
{
if (splash_) {
if (splash_->visible) {
fl_hide_object(splash_);
}
fl_set_object_prehandler(splash_, 0);
// Causes a segmentation fault!
// fl_delete_object(splash_);
// fl_free_object(splash_);
splash_ = 0;
}
if (splash_text_) {
if (splash_text_->visible) {
fl_hide_object(splash_text_);
}
fl_delete_object(splash_text_);
fl_free_object(splash_text_);
splash_text_ = 0;
} }
} }

View File

@ -68,10 +68,6 @@ public:
/// ///
void greyOut() const; void greyOut() const;
/// ///
void show() const;
///
void destroySplash() const;
///
void setScrollbar(double pos, double length_fraction) const; void setScrollbar(double pos, double length_fraction) const;
/// ///
void setScrollbarValue(double y) const { void setScrollbarValue(double y) const {