J�rgen's float patch + "span columns"

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4781 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-07-25 11:06:25 +00:00
parent 01f9ad1e3b
commit 14299daf10
8 changed files with 149 additions and 49 deletions

View File

@ -1,3 +1,11 @@
2002-07-25 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (parseSingleLyXformat2Token): Use default placement
when reading old floats.
* FloatList.C (FloatList): Change the default placement of figure
and tables to "tbp".
2002-07-25 John Levon <moz@compsoc.man.ac.uk>
* MenuBackend.C: using std::max

View File

@ -30,12 +30,12 @@ FloatList::FloatList()
// (these will later be read from a layout file)
// table
Floating table("table", "htbp", "lot", "", "plain", N_("Table"),
Floating table("table", "tbp", "lot", "", "plain", N_("Table"),
N_("List of Tables"), true);
newFloat(table);
// figure
Floating figure("figure", "htbp", "lof",
Floating figure("figure", "tbp", "lof",
"", "plain", N_("Figure"),
N_("List of Figures"), true);
newFloat(figure);

View File

@ -803,34 +803,29 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
old_float << "collapsed true\n";
} else if (tmptok == "fig") {
inset = new InsetFloat(params, "figure");
old_float << "placement htbp\n"
<< "wide false\n"
old_float << "wide false\n"
<< "collapsed false\n";
} else if (tmptok == "tab") {
inset = new InsetFloat(params, "table");
old_float << "placement htbp\n"
<< "wide false\n"
old_float << "wide false\n"
<< "collapsed false\n";
} else if (tmptok == "alg") {
inset = new InsetFloat(params, "algorithm");
old_float << "placement htbp\n"
<< "wide false\n"
old_float << "wide false\n"
<< "collapsed false\n";
} else if (tmptok == "wide-fig") {
inset = new InsetFloat(params, "figure");
//InsetFloat * tmp = new InsetFloat("figure");
//tmp->wide(true);
//inset = tmp;
old_float << "placement htbp\n"
<< "wide true\n"
old_float << "wide true\n"
<< "collapsed false\n";
} else if (tmptok == "wide-tab") {
inset = new InsetFloat(params, "table");
//InsetFloat * tmp = new InsetFloat("table");
//tmp->wide(true);
//inset = tmp;
old_float << "placement htbp\n"
<< "wide true\n"
old_float << "wide true\n"
<< "collapsed false\n";
}

View File

@ -1,3 +1,13 @@
2002-07-25 John Levon <levon@movementarian.org>
* forms/form_float.fd: "Span columns"
2002-07-25 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* FormFloat.C:
* forms/form_float.fd: Implement default placement checkbox;
some minor tweaks
2002-07-25 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Menubar_pimpl.C (create_submenu): add the code for splitting too
@ -10,8 +20,9 @@
2002-07-24 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* FormFloat.C:
* forms/form_float.fd: Implement Wide Float toggle
* FormFloat.C:
* forms/form_float.fd: Implement Wide Float toggle and !-option;
disable h and b with wide floats
2002-07-24 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>

View File

@ -4,6 +4,7 @@
* See the file COPYING.
*
* \author Lars Gullik Bjønnes, larsbj@lyx.org
* \author Juergen Spitzmueller j.spitzmueller@gmx.de
*/
#include <config.h>
@ -27,10 +28,6 @@ FormFloat::FormFloat(ControlFloat & c, Dialogs & d)
{}
// FIX: Needs to be implemented. (Lgb)
// A way to set to float default is missing.
// A way to set "force[!]" is missing.
void FormFloat::build()
{
dialog_.reset(build_float(this));
@ -41,10 +38,12 @@ void FormFloat::build()
bc().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore);
bc().addReadOnly(dialog_->check_default);
bc().addReadOnly(dialog_->check_top);
bc().addReadOnly(dialog_->check_bottom);
bc().addReadOnly(dialog_->check_page);
bc().addReadOnly(dialog_->check_here);
bc().addReadOnly(dialog_->check_force);
bc().addReadOnly(dialog_->check_here_definitely);
bc().addReadOnly(dialog_->check_wide);
}
@ -56,6 +55,12 @@ void FormFloat::apply()
if (fl_get_button(dialog_->check_here_definitely)) {
placement += "H";
} else {
if (fl_get_button(dialog_->check_force)) {
placement += "!";
}
if (fl_get_button(dialog_->check_here)) {
placement += "h";
}
if (fl_get_button(dialog_->check_top)) {
placement += "t";
}
@ -65,9 +70,7 @@ void FormFloat::apply()
if (fl_get_button(dialog_->check_page)) {
placement += "p";
}
if (fl_get_button(dialog_->check_here)) {
placement += "h";
}
}
controller().params().placement = placement;
controller().params().wide = fl_get_button(dialog_->check_wide);
@ -76,17 +79,26 @@ void FormFloat::apply()
void FormFloat::update()
{
bool def_placement = false;
bool top = false;
bool bottom = false;
bool page = false;
bool here = false;
bool force = false;
bool here_definitely = false;
string placement(controller().params().placement);
if (contains(placement, "H")) {
if (placement.empty()) {
def_placement = true;
} else if (contains(placement, "H")) {
here_definitely = true;
} else {
if (contains(placement, "!")) {
force = true;
}
if (contains(placement, "t")) {
top = true;
}
@ -100,37 +112,75 @@ void FormFloat::update()
here = true;
}
}
fl_set_button(dialog_->check_default, def_placement);
fl_set_button(dialog_->check_top, top);
fl_set_button(dialog_->check_bottom, bottom);
fl_set_button(dialog_->check_page, page);
fl_set_button(dialog_->check_here, here);
fl_set_button(dialog_->check_force, force);
fl_set_button(dialog_->check_here_definitely, here_definitely);
setEnabled(dialog_->check_here_definitely, !controller().params().wide);
setEnabled(dialog_->check_here_definitely, !controller().params().wide
&& !def_placement);
if (controller().params().wide) {
fl_set_button(dialog_->check_here, false);
fl_set_button(dialog_->check_bottom, false);
}
setEnabled(dialog_->check_here, !controller().params().wide && !def_placement);
setEnabled(dialog_->check_bottom, !controller().params().wide && !def_placement);
fl_set_button(dialog_->check_wide, controller().params().wide);
setEnabled(dialog_->check_top, !def_placement);
setEnabled(dialog_->check_page, !def_placement);
setEnabled(dialog_->check_force, !def_placement);
}
ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
{
if (ob == dialog_->check_here_definitely) {
bool const def_place = fl_get_button(dialog_->check_default);
if (ob == dialog_->check_default) {
if (def_place) {
fl_set_button(dialog_->check_top, false);
fl_set_button(dialog_->check_bottom, false);
fl_set_button(dialog_->check_page, false);
fl_set_button(dialog_->check_here, false);
fl_set_button(dialog_->check_force, false);
fl_set_button(dialog_->check_here_definitely, false);
}
setEnabled(dialog_->check_top, !def_place);
setEnabled(dialog_->check_bottom, !def_place);
setEnabled(dialog_->check_page, !def_place);
setEnabled(dialog_->check_here, !def_place);
setEnabled(dialog_->check_force, !def_place);
setEnabled(dialog_->check_here_definitely, !def_place);
} else if (ob == dialog_->check_here_definitely) {
if (fl_get_button(dialog_->check_here_definitely)) {
fl_set_button(dialog_->check_top, false);
fl_set_button(dialog_->check_bottom, false);
fl_set_button(dialog_->check_page, false);
fl_set_button(dialog_->check_here, false);
fl_set_button(dialog_->check_force, false);
}
} else {
if (fl_get_button(dialog_->check_here_definitely)) {
fl_set_button(dialog_->check_here_definitely, false);
}
}
if (ob == dialog_->check_wide) {
if (fl_get_button(dialog_->check_wide)) {
fl_set_button(dialog_->check_here_definitely, false);
setEnabled(dialog_->check_here_definitely, false);
}
else
fl_set_button(dialog_->check_here, false);
setEnabled(dialog_->check_here, false);
fl_set_button(dialog_->check_bottom, false);
setEnabled(dialog_->check_bottom, false);
} else {
setEnabled(dialog_->check_here_definitely, true);
setEnabled(dialog_->check_here, true);
setEnabled(dialog_->check_bottom, true);
}
}
return ButtonPolicy::SMI_VALID;

View File

@ -8,14 +8,14 @@ Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
Name: form_float
Width: 360
Height: 240
Number of Objects: 12
Width: 370
Height: 320
Number of Objects: 14
--------------------
class: FL_BOX
type: FLAT_BOX
box: 0 0 360 240
box: 0 0 370 320
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -33,7 +33,7 @@ argument:
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 30 152 30
box: 20 75 152 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -51,7 +51,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 60 152 30
box: 20 105 152 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -69,7 +69,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 190 30 152 30
box: 190 75 152 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -87,7 +87,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 190 60 152 30
box: 190 105 152 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -105,7 +105,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 110 152 30
box: 20 180 152 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -123,7 +123,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 10 200 80 30
box: 10 280 100 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -141,7 +141,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 120 200 70 30
box: 130 280 70 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -159,7 +159,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 200 200 70 30
box: 210 280 70 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -177,7 +177,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 280 200 70 30
box: 290 280 70 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -195,14 +195,14 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 160 30 30
box: 20 230 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Wide Float|#W
label: Span columns|#S
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
@ -213,7 +213,7 @@ argument: 0
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 10 20 340 130
box: 10 20 350 200
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
@ -228,5 +228,41 @@ name:
callback:
argument:
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 135 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Ignore internal placement rules|#g
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_force
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 30 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Float Defaults|#D
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_default
callback: C_FormBaseInputCB
argument: 0
==============================
create_the_forms

View File

@ -1,3 +1,8 @@
2002-07-25 Dekel Tsur <dekelts@tau.ac.il>
* insetfloat.C (read, write): Allow default placement
(floatPlacement_ is empty).
2002-07-23 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* insetminipage.h (noFontChange):

View File

@ -154,10 +154,7 @@ void InsetFloat::write(Buffer const * buf, ostream & os) const
os << "Float " // getInsetName()
<< floatType_ << '\n';
if (floatPlacement_.empty()) {
os << "placement "
<< floatList.getType(floatType_).placement() << "\n";
} else {
if (!floatPlacement_.empty()) {
os << "placement " << floatPlacement_ << "\n";
}
if (wide_) {
@ -179,8 +176,6 @@ void InsetFloat::read(Buffer const * buf, LyXLex & lex)
lex.next();
floatPlacement_ = lex.getString();
} else {
lyxerr << "InsetFloat::Read: Missing placement!"
<< endl;
// take countermeasures
lex.pushToken(token);
}