Lots of graphics dialogs changes. still work needed.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4897 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-08-08 03:50:54 +00:00
parent 2d3cd11c07
commit 714bde0b9e
4 changed files with 1529 additions and 575 deletions

View File

@ -1,3 +1,10 @@
2002-08-08 John Levon <levon@movementarian.org>
* QGraphics.C:
* ui/QGraphicsDialog.ui: lots of fixes and cleanup
* ui/QRefDialog.ui: geometry cleanup
2002-08-07 John Levon <levon@movementarian.org>
* Menubar_pimpl.C: fix compile for gcc 3.1

View File

@ -53,14 +53,13 @@ void QGraphics::build_dialog()
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB);
bc().setCancel(dialog_->closePB);
// FIXME: and the rest ?
bc().addReadOnly(dialog_->rotateGB);
bc().addReadOnly(dialog_->latexoptionsGB);
bc().addReadOnly(dialog_->bbGB);
bc().addReadOnly(dialog_->sizeBG);
bc().addReadOnly(dialog_->displayGB);
bc().addReadOnly(dialog_->subfigure);
bc().addReadOnly(dialog_->subcaption);
bc().addReadOnly(dialog_->filenameL);
@ -84,23 +83,23 @@ void QGraphics::update_contents()
// path, because the controller knows nothing about the doc-dir
controller().bbChanged = false;
if (igp.bb.empty()) {
string const fileWithAbsPath = MakeAbsPath(igp.filename, OnlyPath(igp.filename));
string bb = controller().readBB(fileWithAbsPath);
string const fileWithAbsPath(MakeAbsPath(igp.filename, OnlyPath(igp.filename)));
string const bb(controller().readBB(fileWithAbsPath));
if (!bb.empty()) {
// get the values from the file
// in this case we always have the point-unit
dialog_->lbX->setText(token(bb,' ',0).c_str());
dialog_->lbY->setText(token(bb,' ',1).c_str());
dialog_->rtX->setText(token(bb,' ',2).c_str());
dialog_->rtY->setText(token(bb,' ',3).c_str());
dialog_->lbX->setText(token(bb, ' ', 0).c_str());
dialog_->lbY->setText(token(bb, ' ', 1).c_str());
dialog_->rtX->setText(token(bb, ' ', 2).c_str());
dialog_->rtY->setText(token(bb, ' ', 3).c_str());
}
} else {
// get the values from the inset
controller().bbChanged = true;
dialog_->lbX->setText(token(igp.bb,' ',0).c_str());
dialog_->lbY->setText(token(igp.bb,' ',1).c_str());
dialog_->rtX->setText(token(igp.bb,' ',2).c_str());
dialog_->rtY->setText(token(igp.bb,' ',3).c_str());
dialog_->lbX->setText(token(igp.bb, ' ', 0).c_str());
dialog_->lbY->setText(token(igp.bb, ' ', 1).c_str());
dialog_->rtX->setText(token(igp.bb, ' ', 2).c_str());
dialog_->rtY->setText(token(igp.bb, ' ', 3).c_str());
}
// Update the draft and clip mode
@ -111,61 +110,55 @@ void QGraphics::update_contents()
dialog_->subfigure->setChecked(igp.subcaption);
dialog_->subcaption->setText(igp.subcaptionText.c_str());
int item;
switch (igp.display) {
case InsetGraphicsParams::MONOCHROME: {
dialog_->show->setCurrentItem(0);
break;
case InsetGraphicsParams::DEFAULT: item = 0; break;
case InsetGraphicsParams::MONOCHROME: item = 1; break;
case InsetGraphicsParams::GRAYSCALE: item = 2; break;
case InsetGraphicsParams::COLOR: item = 3; break;
case InsetGraphicsParams::NONE: item = 4; break;
}
case InsetGraphicsParams::GRAYSCALE: {
dialog_->show->setCurrentItem(1);
break;
}
case InsetGraphicsParams::COLOR: {
dialog_->show->setCurrentItem(2);
break;
}
case InsetGraphicsParams::NONE: {
dialog_->show->setCurrentItem(3);
break;
dialog_->show->setCurrentItem(item);
QRadioButton * b;
switch (igp.lyxsize_kind) {
case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->displaydefaultRB; break;
case InsetGraphicsParams::WH: b = dialog_->displaycustomRB; break;
case InsetGraphicsParams::SCALE: b = dialog_->displayscaleRB; break;
}
b->setChecked(true);
dialog_->displaywidthUnit->setCurrentItem(igp.lyxwidth.unit());
dialog_->displayheightUnit->setCurrentItem(igp.lyxheight.unit());
dialog_->displaywidth->setText(tostr(igp.lyxwidth.value()).c_str());
dialog_->displayheight->setText(tostr(igp.lyxheight.value()).c_str());
dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
dialog_->displayratioCB->setChecked(igp.keepLyXAspectRatio);
switch (igp.size_kind) {
case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->defaultRB; break;
case InsetGraphicsParams::WH: b = dialog_->customRB; break;
case InsetGraphicsParams::SCALE: b = dialog_->scaleRB; break;
}
b->setChecked(true);
dialog_->widthUnit->setCurrentItem(igp.width.unit());
dialog_->heightUnit->setCurrentItem(igp.height.unit());
switch (igp.lyxsize_kind) {
case InsetGraphicsParams::DEFAULT_SIZE: {
dialog_->defaultRB->setChecked(TRUE);
break;
}
case InsetGraphicsParams::WH: {
dialog_->customRB->setChecked(TRUE);
break;
}
case InsetGraphicsParams::SCALE: {
dialog_->scaleRB->setChecked(TRUE);
dialog_->width->setText(tostr(igp.width.value()).c_str());
dialog_->height->setText(tostr(igp.height.value()).c_str());
dialog_->scale->setText(tostr(igp.scale).c_str());
break;
}
}
// aspect ratio
dialog_->aspectratio->setChecked(igp.keepAspectRatio);
// now the lyx-internally viewsize
dialog_->displaywidthUnit->setCurrentItem(igp.lyxwidth.unit());
dialog_->displayheightUnit->setCurrentItem(igp.lyxheight.unit());
// Update the rotate angle
dialog_->angle->setText(tostr(igp.rotateAngle).c_str());
if (igp.rotateOrigin.empty()) {
dialog_->origin->setCurrentItem(0);
} else {
//fl_set_choice_text(special_->choice_origin,igp.rotateOrigin.c_str());
// FIXME fl_set_choice_text(special_->choice_origin,igp.rotateOrigin.c_str());
}
// latex options
dialog_->latexoptions->setText(igp.special.c_str());
}
@ -173,14 +166,13 @@ void QGraphics::update_contents()
void QGraphics::apply()
{
// Create the parameters structure and fill the data from the dialog.
InsetGraphicsParams & igp = controller().params();
igp.filename = dialog_->filename->text();
if (!controller().bbChanged) // different to the original one?
igp.bb = string(); // don't write anything
else {
if (!controller().bbChanged) {
igp.bb = string();
} else {
string bb;
string lbX(dialog_->lbX->text());
string lbY(dialog_->lbY->text());
@ -208,43 +200,48 @@ void QGraphics::apply()
}
igp.draft = dialog_->draft->isChecked();
igp.clip = dialog_->clip->isChecked();
igp.subcaption = dialog_->subfigure->isChecked();
igp.subcaptionText = dialog_->subcaption->text();
switch(dialog_->show->currentItem()) {
case 0: igp.display = InsetGraphicsParams::MONOCHROME; break;
case 1: igp.display = InsetGraphicsParams::GRAYSCALE; break;
case 2: igp.display = InsetGraphicsParams::COLOR; break;
case 3: igp.display = InsetGraphicsParams::NONE; break;
switch (dialog_->show->currentItem()) {
case 0: igp.display = InsetGraphicsParams::DEFAULT; break;
case 1: igp.display = InsetGraphicsParams::MONOCHROME; break;
case 2: igp.display = InsetGraphicsParams::GRAYSCALE; break;
case 3: igp.display = InsetGraphicsParams::COLOR; break;
case 4: igp.display = InsetGraphicsParams::NONE; break;
default:;
}
if (dialog_->defaultRB->isChecked())
igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
else if (dialog_->customRB->isChecked())
igp.size_kind = InsetGraphicsParams::WH;
else
igp.size_kind = InsetGraphicsParams::SCALE;
string value(dialog_->width->text());
igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
value = string(dialog_->height->text());
igp.height = LyXLength(strToDbl(value), dialog_->heightUnit->currentLengthItem());
igp.scale = strToInt(string(dialog_->scale->text()));
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
if (dialog_->displaydefaultRB->isChecked())
igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
else if (dialog_->displaycustomRB->isChecked())
igp.lyxsize_kind = InsetGraphicsParams::WH;
else
igp.lyxsize_kind = InsetGraphicsParams::SCALE;
string value(dialog_->width->text());
igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
value = string(dialog_->height->text());
igp.height = LyXLength(strToDbl(value), dialog_->heightUnit->currentLengthItem());
value = string(dialog_->displaywidth->text());
igp.lyxwidth = LyXLength(strToDbl(value), dialog_->displaywidthUnit->currentLengthItem());
value = string(dialog_->displayheight->text());
igp.lyxheight = LyXLength(strToDbl(value), dialog_->displayheightUnit->currentLengthItem());
igp.scale = strToInt(string(dialog_->scale->text()));
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
igp.keepLyXAspectRatio = dialog_->displayratioCB->isChecked();
igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
@ -262,7 +259,6 @@ void QGraphics::apply()
igp.rotateOrigin = string();
igp.special = dialog_->latexoptions->text();
}
@ -273,17 +269,18 @@ void QGraphics::browse()
dialog_->filename->setText(name.c_str());
}
void QGraphics::get()
{
string const filename(dialog_->filename->text());
if (!filename.empty()) {
string const fileWithAbsPath = MakeAbsPath(filename, OnlyPath(filename));
string bb = controller().readBB(fileWithAbsPath);
string const fileWithAbsPath(MakeAbsPath(filename, OnlyPath(filename)));
string const bb(controller().readBB(fileWithAbsPath));
if (!bb.empty()) {
dialog_->lbX->setText(token(bb,' ',0).c_str());
dialog_->lbY->setText(token(bb,' ',1).c_str());
dialog_->rtX->setText(token(bb,' ',2).c_str());
dialog_->rtY->setText(token(bb,' ',3).c_str());
dialog_->lbX->setText(token(bb, ' ', 0).c_str());
dialog_->lbY->setText(token(bb, ' ', 1).c_str());
dialog_->rtX->setText(token(bb, ' ', 2).c_str());
dialog_->rtY->setText(token(bb, ' ', 3).c_str());
}
controller().bbChanged = false;
}
@ -292,5 +289,6 @@ void QGraphics::get()
bool QGraphics::isValid()
{
// FIXME: we need more here.
return !string(dialog_->filename->text().latin1()).empty();
}

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>367</width>
<width>363</width>
<height>425</height>
</rect>
</property>
@ -25,7 +25,7 @@
<name>sizeGripEnabled</name>
<bool>true</bool>
</property>
<grid>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
@ -34,36 +34,22 @@
<name>spacing</name>
<number>6</number>
</property>
<widget row="4" column="0" >
<class>QLabel</class>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>referenceL</cstring>
<cstring>Layout5</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Reference:</string>
<name>spacing</name>
<number>6</number>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignVCenter|AlignLeft</set>
</property>
<property>
<name>buddy</name>
<cstring>referenceED</cstring>
</property>
<property>
<name>hAlign</name>
</property>
</widget>
<widget row="4" column="1" rowspan="1" colspan="2" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>referenceED</cstring>
</property>
</widget>
<widget row="0" column="0" >
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@ -78,7 +64,7 @@
<cstring>bufferCO</cstring>
</property>
</widget>
<widget row="0" column="1" rowspan="1" colspan="2" >
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
@ -92,7 +78,95 @@
</sizepolicy>
</property>
</widget>
<widget row="3" column="0" >
</hbox>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer4</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout4</cstring>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>refsL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Available references in selected document:</string>
</property>
</widget>
<widget>
<class>QListBox</class>
<property stdset="1">
<name>name</name>
<cstring>refsLB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
</sizepolicy>
</property>
<property>
<name>toolTip</name>
<string>Available references</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
@ -107,7 +181,7 @@
<string>Sort references in alphabetical order</string>
</property>
</widget>
<widget row="3" column="1" >
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@ -122,7 +196,7 @@
<string>Update the reference list</string>
</property>
</widget>
<widget row="3" column="2" >
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@ -144,7 +218,221 @@
<string>Move the document cursor to reference</string>
</property>
</widget>
<widget row="7" column="0" rowspan="1" colspan="3" >
<spacer>
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>referenceED</cstring>
</property>
</widget>
<widget row="1" column="1" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>&lt;reference&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>&lt;page&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>on page &lt;page&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>&lt;reference&gt; on page &lt;page&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Formatted reference</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>typeCO</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property>
<name>toolTip</name>
<string>Reference as it appears in output</string>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>referenceL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Reference:</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignVCenter|AlignLeft</set>
</property>
<property>
<name>buddy</name>
<cstring>referenceED</cstring>
</property>
<property>
<name>hAlign</name>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>typeLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Format:</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignVCenter|AlignLeft</set>
</property>
<property>
<name>buddy</name>
<cstring>typeLA</cstring>
</property>
<property>
<name>hAlign</name>
</property>
</widget>
</grid>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer3</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>MinimumExpanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>nameL</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Name:</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignVCenter|AlignLeft</set>
</property>
<property>
<name>buddy</name>
<cstring>nameED</cstring>
</property>
<property>
<name>hAlign</name>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>nameED</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
@ -208,147 +496,7 @@
</widget>
</hbox>
</widget>
<widget row="2" column="0" rowspan="1" colspan="3" >
<class>QListBox</class>
<property stdset="1">
<name>name</name>
<cstring>refsLB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
</sizepolicy>
</property>
<property>
<name>toolTip</name>
<string>Available references</string>
</property>
</widget>
<widget row="1" column="0" rowspan="1" colspan="3" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>refsL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Available references in selected document:</string>
</property>
</widget>
<widget row="5" column="1" rowspan="1" colspan="2" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>&lt;reference&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>&lt;page&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>on page &lt;page&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>&lt;reference&gt; on page &lt;page&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Formatted reference</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>typeCO</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property>
<name>toolTip</name>
<string>Reference as it appears in output</string>
</property>
</widget>
<widget row="6" column="1" rowspan="1" colspan="2" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>nameED</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
</widget>
<widget row="6" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>nameL</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Name:</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignVCenter|AlignLeft</set>
</property>
<property>
<name>buddy</name>
<cstring>nameED</cstring>
</property>
<property>
<name>hAlign</name>
</property>
</widget>
<widget row="5" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>typeLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Format:</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignVCenter|AlignLeft</set>
</property>
<property>
<name>buddy</name>
<cstring>typeLA</cstring>
</property>
<property>
<name>hAlign</name>
</property>
</widget>
</grid>
</vbox>
</widget>
<connections>
<connection>