]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetHFill.cpp
Embedding: display a pin at the top left corner of embedded figures
[lyx.git] / src / insets / InsetHFill.cpp
index 30980f1acd54558c56aae64cc0249dac58e696bf..76af40d23f839be8b0dcc6e3162db23d927afde1 100644 (file)
 
 #include <ostream>
 
+using namespace std;
 
 namespace lyx {
 
 
 InsetHFill::InsetHFill()
-       : InsetCommand(InsetCommandParams(HFILL_CODE), std::string())
+       : InsetCommand(InsetCommandParams(HFILL_CODE), string())
 {}
 
 
-CommandInfo const * InsetHFill::findInfo(std::string const & /* cmdName */)
+CommandInfo const * InsetHFill::findInfo(string const & /* cmdName */)
 {
        static const char * const paramnames[] = {""};
        static const CommandInfo info = {0, paramnames, 0};
@@ -54,19 +55,13 @@ void InsetHFill::metrics(MetricsInfo &, Dimension & dim) const
 void InsetHFill::draw(PainterInfo & pi, int x, int y) const
 {
        Dimension const dim = Inset::dimension(*pi.base.bv);
-       x += 1;
+       int const x0 = x + 1;
+       int const x1 = x + dim.wid - 2;
+       int const y0 = y + dim.des - 1;
+       int const y1 = y - dim.asc + 1;
 
-       int const y0 = y + dim.des;
-       int const y1 = y - dim.asc;
-
-       pi.pain.line(x, y1, x, y0, Color_added_space);
-       if (dim.wid == 0)
-               // The HFill is not expanded.
-               return;
-
-       int const x1 = x + dim.wid;
-
-       pi.pain.line(x, y, x1, y, Color_added_space,
+       pi.pain.line(x0, y1, x0, y0, Color_added_space);
+       pi.pain.line(x0, y, x1, y, Color_added_space,
                frontend::Painter::line_onoffdash);
        pi.pain.line(x1, y1, x1, y0, Color_added_space);
 }
@@ -94,7 +89,7 @@ int InsetHFill::docbook(Buffer const &, odocstream & os,
 }
 
 
-void InsetHFill::write(Buffer const &, std::ostream & os) const
+void InsetHFill::write(Buffer const &, ostream & os) const
 {
        os << "\n\\hfill\n";
 }