get rid of QT3_SUPPORT and some cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14748 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-08-17 08:55:23 +00:00
parent 6d3edcf760
commit 6aabd01568
2 changed files with 29 additions and 29 deletions

View File

@ -144,10 +144,10 @@ void QGraphics::update_contents()
dialog_->rtYunit->clear(); dialog_->rtYunit->clear();
for (vector<string>::const_iterator it = bb_units.begin(); for (vector<string>::const_iterator it = bb_units.begin();
it != bb_units.end(); ++it) { it != bb_units.end(); ++it) {
dialog_->lbXunit->insertItem(toqstr(*it), -1); dialog_->lbXunit->addItem(toqstr(*it));
dialog_->lbYunit->insertItem(toqstr(*it), -1); dialog_->lbYunit->addItem(toqstr(*it));
dialog_->rtXunit->insertItem(toqstr(*it), -1); dialog_->rtXunit->addItem(toqstr(*it));
dialog_->rtYunit->insertItem(toqstr(*it), -1); dialog_->rtYunit->addItem(toqstr(*it));
} }
InsetGraphicsParams & igp = controller().params(); InsetGraphicsParams & igp = controller().params();
@ -176,10 +176,10 @@ void QGraphics::update_contents()
dialog_->lbY->setText(toqstr(token(bb, ' ', 1))); dialog_->lbY->setText(toqstr(token(bb, ' ', 1)));
dialog_->rtX->setText(toqstr(token(bb, ' ', 2))); dialog_->rtX->setText(toqstr(token(bb, ' ', 2)));
dialog_->rtY->setText(toqstr(token(bb, ' ', 3))); dialog_->rtY->setText(toqstr(token(bb, ' ', 3)));
dialog_->lbXunit->setCurrentItem(0); dialog_->lbXunit->setCurrentIndex(0);
dialog_->lbYunit->setCurrentItem(0); dialog_->lbYunit->setCurrentIndex(0);
dialog_->rtXunit->setCurrentItem(0); dialog_->rtXunit->setCurrentIndex(0);
dialog_->rtYunit->setCurrentItem(0); dialog_->rtYunit->setCurrentIndex(0);
controller().bbChanged = false; controller().bbChanged = false;
} else { } else {
// get the values from the inset // get the values from the inset
@ -191,28 +191,28 @@ void QGraphics::update_contents()
if (isValidLength(xl, &anyLength)) { if (isValidLength(xl, &anyLength)) {
dialog_->lbX->setText(toqstr(convert<string>(anyLength.value()))); dialog_->lbX->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]); string const unit(unit_name[anyLength.unit()]);
dialog_->lbXunit->setCurrentItem(getItemNo(bb_units, unit)); dialog_->lbXunit->setCurrentIndex(getItemNo(bb_units, unit));
} else { } else {
dialog_->lbX->setText(toqstr(xl)); dialog_->lbX->setText(toqstr(xl));
} }
if (isValidLength(yl, &anyLength)) { if (isValidLength(yl, &anyLength)) {
dialog_->lbY->setText(toqstr(convert<string>(anyLength.value()))); dialog_->lbY->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]); string const unit(unit_name[anyLength.unit()]);
dialog_->lbYunit->setCurrentItem(getItemNo(bb_units, unit)); dialog_->lbYunit->setCurrentIndex(getItemNo(bb_units, unit));
} else { } else {
dialog_->lbY->setText(toqstr(xl)); dialog_->lbY->setText(toqstr(xl));
} }
if (isValidLength(xr, &anyLength)) { if (isValidLength(xr, &anyLength)) {
dialog_->rtX->setText(toqstr(convert<string>(anyLength.value()))); dialog_->rtX->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]); string const unit(unit_name[anyLength.unit()]);
dialog_->rtXunit->setCurrentItem(getItemNo(bb_units, unit)); dialog_->rtXunit->setCurrentIndex(getItemNo(bb_units, unit));
} else { } else {
dialog_->rtX->setText(toqstr(xl)); dialog_->rtX->setText(toqstr(xl));
} }
if (isValidLength(yr, &anyLength)) { if (isValidLength(yr, &anyLength)) {
dialog_->rtY->setText(toqstr(convert<string>(anyLength.value()))); dialog_->rtY->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]); string const unit(unit_name[anyLength.unit()]);
dialog_->rtYunit->setCurrentItem(getItemNo(bb_units, unit)); dialog_->rtYunit->setCurrentIndex(getItemNo(bb_units, unit));
} else { } else {
dialog_->rtY->setText(toqstr(xl)); dialog_->rtY->setText(toqstr(xl));
} }
@ -236,7 +236,7 @@ void QGraphics::update_contents()
case lyx::graphics::ColorDisplay: item = 3; break; case lyx::graphics::ColorDisplay: item = 3; break;
case lyx::graphics::NoDisplay: item = 0; break; case lyx::graphics::NoDisplay: item = 0; break;
} }
dialog_->showCB->setCurrentItem(item); dialog_->showCB->setCurrentIndex(item);
dialog_->showCB->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly()); dialog_->showCB->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly());
dialog_->displayCB->setChecked(igp.display != lyx::graphics::NoDisplay); dialog_->displayCB->setChecked(igp.display != lyx::graphics::NoDisplay);
dialog_->displayscale->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly()); dialog_->displayscale->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly());
@ -249,15 +249,15 @@ void QGraphics::update_contents()
// units are defined in lengthcommon.C // units are defined in lengthcommon.C
// 1. the width (a listttype) // 1. the width (a listttype)
dialog_->widthUnit->clear(); dialog_->widthUnit->clear();
dialog_->widthUnit->insertItem(qt_("Scale%")); dialog_->widthUnit->addItem(qt_("Scale%"));
for (int i = 0; i < num_units; i++) for (int i = 0; i < num_units; i++)
dialog_->widthUnit->insertItem(unit_name_gui[i], -1); dialog_->widthUnit->addItem(unit_name_gui[i]);
if (!igp.scale.empty() if (!igp.scale.empty()
&& !float_equal(convert<double>(igp.scale), 0.0, 0.05) && !float_equal(convert<double>(igp.scale), 0.0, 0.05)
|| igp.width.empty()) { || igp.width.empty()) {
dialog_->Width->setText(toqstr(igp.scale)); dialog_->Width->setText(toqstr(igp.scale));
dialog_->widthUnit->setCurrentItem(0); dialog_->widthUnit->setCurrentIndex(0);
} else { } else {
// no scale means default width/height // no scale means default width/height
dialog_->Width->setText(toqstr(convert<string>(igp.width.value()))); dialog_->Width->setText(toqstr(convert<string>(igp.width.value())));
@ -265,14 +265,14 @@ void QGraphics::update_contents()
// it is a "Scale%" or another user defined unit! // it is a "Scale%" or another user defined unit!
// +1 instead of the "Scale%" option // +1 instead of the "Scale%" option
int unit_ = igp.width.unit(); int unit_ = igp.width.unit();
dialog_->widthUnit->setCurrentItem(unit_ + 1); dialog_->widthUnit->setCurrentIndex(unit_ + 1);
} }
// 2. the height (a lengthgcombo type) // 2. the height (a lengthgcombo type)
lengthToWidgets(dialog_->Height, dialog_->heightUnit, lengthToWidgets(dialog_->Height, dialog_->heightUnit,
igp.height.asString(), unitDefault); igp.height.asString(), unitDefault);
// enable height input in case of non "Scale%" as width-unit // enable height input in case of non "Scale%" as width-unit
bool use_height = (dialog_->widthUnit->currentItem() > 0); bool use_height = (dialog_->widthUnit->currentIndex() > 0);
dialog_->heightL->setEnabled(use_height); dialog_->heightL->setEnabled(use_height);
dialog_->Height->setEnabled(use_height); dialog_->Height->setEnabled(use_height);
dialog_->heightUnit->setEnabled(use_height); dialog_->heightUnit->setEnabled(use_height);
@ -290,13 +290,13 @@ void QGraphics::update_contents()
for (vector<string>::const_iterator it = origin_lang.begin(); for (vector<string>::const_iterator it = origin_lang.begin();
it != origin_lang.end(); ++it) it != origin_lang.end(); ++it)
dialog_->origin->insertItem(toqstr(*it), -1); dialog_->origin->addItem(toqstr(*it));
if (!igp.rotateOrigin.empty()) if (!igp.rotateOrigin.empty())
dialog_->origin->setCurrentItem( dialog_->origin->setCurrentIndex(
getItemNo(origin_ltx, igp.rotateOrigin)); getItemNo(origin_ltx, igp.rotateOrigin));
else else
dialog_->origin->setCurrentItem(0); dialog_->origin->setCurrentIndex(0);
// disable edit button when no filename is present // disable edit button when no filename is present
dialog_->editPB->setDisabled(dialog_->filename->text().isEmpty()); dialog_->editPB->setDisabled(dialog_->filename->text().isEmpty());
@ -350,7 +350,7 @@ void QGraphics::apply()
igp.subcaption = dialog_->subfigure->isChecked(); igp.subcaption = dialog_->subfigure->isChecked();
igp.subcaptionText = fromqstr(dialog_->subcaption->text()); igp.subcaptionText = fromqstr(dialog_->subcaption->text());
switch (dialog_->showCB->currentItem()) { switch (dialog_->showCB->currentIndex()) {
case 0: igp.display = lyx::graphics::DefaultDisplay; break; case 0: igp.display = lyx::graphics::DefaultDisplay; break;
case 1: igp.display = lyx::graphics::MonochromeDisplay; break; case 1: igp.display = lyx::graphics::MonochromeDisplay; break;
case 2: igp.display = lyx::graphics::GrayscaleDisplay; break; case 2: igp.display = lyx::graphics::GrayscaleDisplay; break;
@ -362,7 +362,7 @@ void QGraphics::apply()
igp.display = lyx::graphics::NoDisplay; igp.display = lyx::graphics::NoDisplay;
string value = fromqstr(dialog_->Width->text()); string value = fromqstr(dialog_->Width->text());
if (dialog_->widthUnit->currentItem() > 0 || isValidLength(value)) { if (dialog_->widthUnit->currentIndex() > 0 || isValidLength(value)) {
// width/height combination // width/height combination
igp.width = igp.width =
widgetsToLength(dialog_->Width, dialog_->widthUnit); widgetsToLength(dialog_->Width, dialog_->widthUnit);
@ -393,7 +393,7 @@ void QGraphics::apply()
// save the latex name for the origin. If it is the default // save the latex name for the origin. If it is the default
// then origin_ltx returns "" // then origin_ltx returns ""
igp.rotateOrigin = igp.rotateOrigin =
QGraphics::origin_ltx[dialog_->origin->currentItem()]; QGraphics::origin_ltx[dialog_->origin->currentIndex()];
// more latex options // more latex options
igp.special = fromqstr(dialog_->latexoptions->text()); igp.special = fromqstr(dialog_->latexoptions->text());
@ -412,10 +412,10 @@ void QGraphics::getBB()
dialog_->rtY->setText(toqstr(token(bb, ' ', 3))); dialog_->rtY->setText(toqstr(token(bb, ' ', 3)));
// the default units for the bb values when reading // the default units for the bb values when reading
// it from the file // it from the file
dialog_->lbXunit->setCurrentItem(0); dialog_->lbXunit->setCurrentIndex(0);
dialog_->lbYunit->setCurrentItem(0); dialog_->lbYunit->setCurrentIndex(0);
dialog_->rtXunit->setCurrentItem(0); dialog_->rtXunit->setCurrentIndex(0);
dialog_->rtYunit->setCurrentItem(0); dialog_->rtYunit->setCurrentIndex(0);
} }
controller().bbChanged = false; controller().bbChanged = false;
} }

View File

@ -123,7 +123,7 @@ void QGraphicsDialog::change_bb()
void QGraphicsDialog::change_WUnit() void QGraphicsDialog::change_WUnit()
{ {
bool useHeight = (widthUnit->currentItem() > 0); bool useHeight = (widthUnit->currentIndex() > 0);
Height->setEnabled(useHeight); Height->setEnabled(useHeight);
heightUnit->setEnabled(useHeight); heightUnit->setEnabled(useHeight);
heightL->setEnabled(useHeight); heightL->setEnabled(useHeight);