+void FormGraphics::updateBB(string const & filename, string const & bb_inset)
+{
+ // Update dialog with details from inset
+ // set the bounding box values, if exists. First we need the whole
+ // path, because the controller knows nothing about the doc-dir
+ controller().bbChanged = false;
+ if (bb_inset.empty()) {
+ lyxerr[Debug::GRAPHICS] << "update:: no BoundingBox" << endl;
+ string const fileWithAbsPath =
+ MakeAbsPath(filename, OnlyPath(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
+ fl_set_input(bbox_->input_bb_x0,
+ token(bb,' ',0).c_str());
+ fl_set_input(bbox_->input_bb_y0,
+ token(bb,' ',1).c_str());
+ fl_set_input(bbox_->input_bb_x1,
+ token(bb,' ',2).c_str());
+ fl_set_input(bbox_->input_bb_y1,
+ token(bb,' ',3).c_str());
+
+ } else {
+ // no bb from file
+ fl_set_input(bbox_->input_bb_x0, bb.c_str());
+ fl_set_input(bbox_->input_bb_y0, bb.c_str());
+ fl_set_input(bbox_->input_bb_x1, bb.c_str());
+ fl_set_input(bbox_->input_bb_y1, bb.c_str());
+ }
+ // "pt"
+ fl_set_choice(bbox_->choice_bb_units, 1);
+
+ } else {
+ // get the values from the inset
+ lyxerr[Debug::GRAPHICS] << "update:: igp has BoundingBox"
+ << endl;
+ controller().bbChanged = true;
+ LyXLength anyLength;
+ anyLength = LyXLength(token(bb_inset,' ',0));
+ updateWidgetsFromLength(bbox_->input_bb_x0,
+ bbox_->choice_bb_units,anyLength,"pt");
+ anyLength = LyXLength(token(bb_inset,' ',1));
+ updateWidgetsFromLength(bbox_->input_bb_y0,
+ bbox_->choice_bb_units,anyLength,"pt");
+ anyLength = LyXLength(token(bb_inset,' ',2));
+ updateWidgetsFromLength(bbox_->input_bb_x1,
+ bbox_->choice_bb_units,anyLength,"pt");
+ anyLength = LyXLength(token(bb_inset,' ',3));
+ updateWidgetsFromLength(bbox_->input_bb_y1,
+ bbox_->choice_bb_units,anyLength,"pt");
+ }
+}
+