]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormGraphics.C
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / FormGraphics.C
index 8dd690560d7ee63be265e92fa6203e50451f90d6..af3f41d5cccedf081fc626648ca5f27369ac51d5 100644 (file)
@@ -4,46 +4,48 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Baruch Even
- * \author Herbert Voss
+ * \author Herbert Voß
  * \author Rob Lahaye
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#include "xformsBC.h"
-#include "ControlGraphics.h"
 #include "FormGraphics.h"
+#include "ControlGraphics.h"
 #include "forms/form_graphics.h"
 
+#include "controllers/helper_funcs.h"
+
 #include "checkedwidgets.h"
 #include "input_validators.h"
 #include "Tooltips.h"
 #include "xforms_helpers.h"
+#include "xformsBC.h"
 
-#include "debug.h" // for lyxerr
 #include "lyxrc.h" // for lyxrc.display_graphics
 
 #include "insets/insetgraphicsParams.h"
 
-#include "controllers/helper_funcs.h" // for getStringFromVector
-
 #include "frontends/Alert.h"
 
-#include "support/tostr.h"
-#include "support/lstrings.h"  // for strToDbl
 #include "support/lyxlib.h"  // for float_equal
-#include "support/filetools.h"  // for MakeAbsPath etc
-
-#include "support/BoostFormat.h"
+#include "support/tostr.h"
 
 #include "lyx_forms.h"
 
-using namespace lyx::support;
+using lyx::support::bformat;
+using lyx::support::float_equal;
+using lyx::support::getStringFromVector;
+using lyx::support::strToDbl;
+using lyx::support::strToInt;
+using lyx::support::token;
 
 using std::endl;
+
 using std::vector;
+using std::string;
 
 
 namespace {
@@ -274,14 +276,14 @@ void FormGraphics::build()
 
        // set the right default unit
        switch (lyxrc.default_papersize) {
-       case BufferParams::PAPER_DEFAULT: break;
-       case BufferParams::PAPER_USLETTER:
-       case BufferParams::PAPER_LEGALPAPER:
-       case BufferParams::PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
-       case BufferParams::PAPER_A3PAPER:
-       case BufferParams::PAPER_A4PAPER:
-       case BufferParams::PAPER_A5PAPER:
-       case BufferParams::PAPER_B5PAPER: defaultUnit = "cm"; break;
+       case PAPER_DEFAULT: break;
+       case PAPER_USLETTER:
+       case PAPER_LEGALPAPER:
+       case PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
+       case PAPER_A3PAPER:
+       case PAPER_A4PAPER:
+       case PAPER_A5PAPER:
+       case PAPER_B5PAPER: defaultUnit = "cm"; break;
        }
 }
 
@@ -292,7 +294,8 @@ void FormGraphics::apply()
        InsetGraphicsParams & igp = controller().params();
 
        // the file section
-       igp.filename = getString(file_->input_filename);
+       igp.filename.set(getString(file_->input_filename),
+                        kernel().bufferFilepath());
 
        igp.lyxscale = strToInt(getString(file_->input_lyxscale));
        if (igp.lyxscale == 0) {
@@ -301,19 +304,19 @@ void FormGraphics::apply()
 
        switch (fl_get_choice(file_->choice_display)) {
        case 5:
-               igp.display = grfx::NoDisplay;
+               igp.display = lyx::graphics::NoDisplay;
                break;
        case 4:
-               igp.display = grfx::ColorDisplay;
+               igp.display = lyx::graphics::ColorDisplay;
                break;
        case 3:
-               igp.display = grfx::GrayscaleDisplay;
+               igp.display = lyx::graphics::GrayscaleDisplay;
                break;
        case 2:
-               igp.display = grfx::MonochromeDisplay;
+               igp.display = lyx::graphics::MonochromeDisplay;
                break;
        case 1:
-               igp.display = grfx::DefaultDisplay;
+               igp.display = lyx::graphics::DefaultDisplay;
        }
 
        // first item in choice_width means scaling
@@ -424,23 +427,25 @@ void FormGraphics::update() {
        InsetGraphicsParams & igp = controller().params();
 
        // the file section
-       fl_set_input(file_->input_filename, igp.filename.c_str());
+       string const name =
+               igp.filename.outputFilename(kernel().bufferFilepath());
+       fl_set_input(file_->input_filename, name.c_str());
        fl_set_input(file_->input_lyxscale, tostr(igp.lyxscale).c_str());
 
        switch (igp.display) {
-       case grfx::NoDisplay:
+       case lyx::graphics::NoDisplay:
                fl_set_choice(file_->choice_display, 5);
                break;
-       case grfx::ColorDisplay:
+       case lyx::graphics::ColorDisplay:
                fl_set_choice(file_->choice_display, 4);
                break;
-       case grfx::GrayscaleDisplay:
+       case lyx::graphics::GrayscaleDisplay:
                fl_set_choice(file_->choice_display, 3);
                break;
-       case grfx::MonochromeDisplay:
+       case lyx::graphics::MonochromeDisplay:
                fl_set_choice(file_->choice_display, 2);
                break;
-       case grfx::DefaultDisplay:
+       case lyx::graphics::DefaultDisplay:
                fl_set_choice(file_->choice_display, 1);
        }
 
@@ -479,7 +484,7 @@ void FormGraphics::update() {
        // the bb section
        // set the bounding box values, if exists. First we need the whole
        // path, because the controller knows nothing about the doc-dir
-       updateBB(igp.filename, igp.bb);
+       updateBB(igp.filename.absFilename(), igp.bb);
        fl_set_button(bbox_->check_clip, igp.clip);
 
        // the extra section
@@ -569,7 +574,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
        if (ob == file_->button_browse) {
                // Get the filename from the dialog
                string const in_name = getString(file_->input_filename);
-               string const out_name = controller().Browse(in_name);
+               string const out_name = controller().browse(in_name);
                lyxerr[Debug::GRAPHICS]
                        << "[FormGraphics]out_name: " << out_name << endl;
                if (out_name != in_name && !out_name.empty()) {